EBS获取附件URL
http://wenku.baidu.com/link?url=MnYX269RBqW9ZRh-4famwduhYq9As0-vsIyVPA7aqv64cdxxjZEOaEE1_KZ9SGjY9qCxYIb-Fuh12pN05eZDBifBvwv5tReqjNMfZyMhW3W
TYPE CURTYPE IS REF CURSOR;
TYPE C_ATTACHED_RECORD IS RECORD(
ROW_NUM NUMBER,
PK1_VALUE NUMBER,
USER_ENTITY_NAME VARCHAR2(1000),
TITLE VARCHAR2(1000),
FILE_NAME VARCHAR2(1000),
DATATYPE_NAME VARCHAR2(1000),
FILE_DATA BLOB,
FILE_ID NUMBER);
----------------------------------------------------------------------------------
--功能名称:
-- GET_ATTACHED_HTML
--功能说明:
-- 获取附件列表html代码
--参数说明:
-- PITEM_TYPE 工作流代码
-- P_ITEM_KEY 审批关键字
-- P_FUNCTION_NAME 附件功能名称
-- P_ENTITY_NAME 文档实体标识
-- P_TABLE_NAME 文档实体表
-- p_BLOCK_NAME 附件功能的块名
-- 返回附件列表的HTML代码
--版本信息:
-- 1.0 Initial Creation
----------------------------------------------------------------------------------
FUNCTION GET_ATTACHED_HTML(PITEM_TYPE IN VARCHAR2,
PITEM_KEY IN VARCHAR2,
P_FUNCTION_NAME IN VARCHAR2,
P_ENTITY_NAME IN VARCHAR2,
P_TABLE_NAME IN VARCHAR2,
p_BLOCK_NAME IN VARCHAR2) RETURN VARCHAR2;
----------------------------------------------------------------------------------
--功能名称:
-- GET_OUTPUT_URL
--功能说明:
-- 获取附件下载链接地址
--参数说明:
-- P_PK1_VALUE 附件的主关键字值
-- P_FILE_ID 附件文件ID
-- P_ENTITY_NAME 文档实体标识
-- 返回指定附件文件的下载链接地址
--版本信息:
-- 1.0 Initial Creation
----------------------------------------------------------------------------------
FUNCTION GET_OUTPUT_URL(P_PK1_VALUE IN NUMBER,
P_FILE_ID IN NUMBER,
P_ENTITY_NAME IN VARCHAR2) RETURN VARCHAR2;
/
----------------------------------------------------------------------------------
--功能名称:
-- GET_ATTACHED_HTML
--功能说明:
-- 获取附件列表html代码
--参数说明:
-- PITEM_TYPE 工作流代码
-- P_ITEM_KEY 审批关键字
-- P_FUNCTION_NAME 附件功能名称
-- P_ENTITY_NAME 文档实体标识
-- P_TABLE_NAME 文档实体表
-- p_BLOCK_NAME 附件功能的块名
-- 返回附件列表的HTML代码
--版本信息:
-- 1.0 Initial Creation
----------------------------------------------------------------------------------
FUNCTION GET_ATTACHED_HTML(PITEM_TYPE IN VARCHAR2,
PITEM_KEY IN VARCHAR2,
P_FUNCTION_NAME IN VARCHAR2,
P_ENTITY_NAME IN VARCHAR2,
P_TABLE_NAME IN VARCHAR2,
P_BLOCK_NAME IN VARCHAR2) RETURN VARCHAR2 IS
C_ATTACHED CURTYPE;
V_DOCUMENT_ATTACHED VARCHAR2(32000);
VATTACHEDINFO C_ATTACHED_RECORD;
V_COUNT NUMBER := 1;
V_PK1_VALUE NUMBER;
VPK1_FILED VARCHAR2(61);
VPK2_FILED VARCHAR2(61);
VPK3_FILED VARCHAR2(61);
VPK4_FILED VARCHAR2(61);
VPK5_FILED VARCHAR2(61);
VPK1 VARCHAR2(61);
VPK2 VARCHAR2(61);
VPK3 VARCHAR2(61);
VPK4 VARCHAR2(61);
VPK5 VARCHAR2(61);
VURL VARCHAR2(500);
VCONDITION_FIELD VARCHAR2(100);
VCONDITION_OPERATOR VARCHAR2(10);
VCONDITION_VALUE1 VARCHAR2(100);
VCONDITION_VALUE2 VARCHAR2(100);
VQUERY_PERMISSION_TYPE VARCHAR2(10);
VINSERT_PERMISSION_TYPE VARCHAR2(10);
VUPDATE_PERMISSION_TYPE VARCHAR2(10);
VDELETE_PERMISSION_TYPE VARCHAR2(10);
V_SQL VARCHAR2(32000);
C_SQL VARCHAR2(32000);
BEGIN
BEGIN
SELECT ABE.PK1_FIELD,
ABE.PK2_FIELD,
ABE.PK3_FIELD,
ABE.PK4_FIELD,
ABE.PK5_FIELD,
ABE.CONDITION_FIELD,
ABE.CONDITION_OPERATOR,
ABE.CONDITION_VALUE1,
ABE.CONDITION_VALUE2,
ABE.QUERY_PERMISSION_TYPE,
ABE.INSERT_PERMISSION_TYPE,
ABE.UPDATE_PERMISSION_TYPE,
ABE.DELETE_PERMISSION_TYPE
INTO VPK1_FILED,
VPK2_FILED,
VPK3_FILED,
VPK4_FILED,
VPK5_FILED,
VCONDITION_FIELD,
VCONDITION_OPERATOR,
VCONDITION_VALUE1,
VCONDITION_VALUE2,
VQUERY_PERMISSION_TYPE,
VINSERT_PERMISSION_TYPE,
VUPDATE_PERMISSION_TYPE,
VDELETE_PERMISSION_TYPE
FROM FND_ATTACHMENT_BLK_ENTITIES ABE,
FND_ATTACHMENT_BLOCKS AB,
FND_ATTACHMENT_FUNCTIONS AF
WHERE ABE.ATTACHMENT_BLK_ID = AB.ATTACHMENT_BLK_ID
AND AB.ATTACHMENT_FUNCTION_ID = AF.ATTACHMENT_FUNCTION_ID
AND AF.FUNCTION_NAME = P_FUNCTION_NAME
AND AF.FUNCTION_TYPE = 'F'
AND ABE.DATA_OBJECT_CODE = P_ENTITY_NAME
AND AB.BLOCK_NAME = P_BLOCK_NAME
AND ROWNUM = 1;
EXCEPTION
WHEN NO_DATA_FOUND THEN
SELECT ABE.PK1_FIELD,
ABE.PK2_FIELD,
ABE.PK3_FIELD,
ABE.PK4_FIELD,
ABE.PK5_FIELD,
ABE.CONDITION_FIELD,
ABE.CONDITION_OPERATOR,
ABE.CONDITION_VALUE1,
ABE.CONDITION_VALUE2,
ABE.QUERY_PERMISSION_TYPE,
ABE.INSERT_PERMISSION_TYPE,
ABE.UPDATE_PERMISSION_TYPE,
ABE.DELETE_PERMISSION_TYPE
INTO VPK1_FILED,
VPK2_FILED,
VPK3_FILED,
VPK4_FILED,
VPK5_FILED,
VCONDITION_FIELD,
VCONDITION_OPERATOR,
VCONDITION_VALUE1,
VCONDITION_VALUE2,
VQUERY_PERMISSION_TYPE,
VINSERT_PERMISSION_TYPE,
VUPDATE_PERMISSION_TYPE,
VDELETE_PERMISSION_TYPE
FROM FND_ATTACHMENT_BLK_ENTITIES ABE,
FND_ATTACHMENT_BLOCKS AB,
FND_ATTACHMENT_FUNCTIONS AF
WHERE ABE.ATTACHMENT_BLK_ID = AB.ATTACHMENT_BLK_ID
AND AB.ATTACHMENT_FUNCTION_ID = AF.ATTACHMENT_FUNCTION_ID
AND AF.FUNCTION_NAME = P_FUNCTION_NAME
AND AF.FUNCTION_TYPE = 'O'
AND ABE.DATA_OBJECT_CODE = P_ENTITY_NAME
AND AB.BLOCK_NAME = P_BLOCK_NAME
AND ROWNUM = 1;
END;
V_SQL := 'SELECT ' || SUBSTR(VPK1_FILED,
INSTR(VPK1_FILED, '.', 1) + 1,
LENGTH(VPK1_FILED)) || ' FROM ' ||
P_TABLE_NAME || ' WHERE ITEM_KEY = ''' || PITEM_KEY || '''' ||
' AND ROWNUM = 1';
EXECUTE IMMEDIATE V_SQL
INTO V_PK1_VALUE;
V_DOCUMENT_ATTACHED := '<table width=100% border="0" cellspacing="0" cellpadding="0" >
<tr><td><table cellpadding="0" cellspacing="0" border="0" width="100%" class="x74" style="background-image:url(/OA_HTML/cabo/images/swan/headingBarBg.gif);">
<tr>
<td width="100%"><h2 class="x75">附件列表</h2></td></tr></table></td></tr>
<tr><td><table width="100%" class="x1h" cellpadding="1" cellspacing="0" summary="Action History" border="1" >
<tr>
<th class="x1r x4j" scope="col" width="2%" align="LEFT" valign="baseline" ><span class="x24">序号</span></th>
<th class="x1r x4j" scope="col" width="5%" align="LEFT" valign="baseline" ><span class="x24">实体名</span></th>
<th class="x1r x4j" scope="col" width="10%" align="LEFT" valign="baseline" ><span class="x24">标题</span></th>
<th class="x1r x4j" scope="col" width="15%" align="LEFT" valign="baseline" ><span class="x24">文件名</span></th>
</tr>';
C_SQL := 'SELECT ROWNUM ROW_NUM,
PK1_VALUE,
USER_ENTITY_NAME,
TITLE,
FILE_NAME,
DATATYPE_NAME,
FILE_DATA,
FILE_ID
FROM (SELECT FAD.PK1_VALUE,
FAD.USER_ENTITY_NAME,
FAD.TITLE,
FAD.FILE_NAME,
FAD.DATATYPE_NAME,
FL.FILE_DATA,
FL.FILE_ID
FROM FND_ATTACHED_DOCS_FORM_VL FAD, FND_LOBS FL
WHERE FAD.MEDIA_ID = FL.FILE_ID
AND FAD.FUNCTION_NAME = ''' ||
P_FUNCTION_NAME ||''''||
' AND FAD.PK1_VALUE IN ' ||
'(SELECT T.' ||
SUBSTR(VPK1_FILED,
INSTR(VPK1_FILED, '.', 1) + 1,
LENGTH(VPK1_FILED)) ||
' FROM ' || P_TABLE_NAME ||
' T WHERE T.ITEM_KEY = ''' ||
PITEM_KEY || '''' || ')
AND FAD.ENTITY_NAME = '''||P_ENTITY_NAME||''''
||' ORDER BY FAD.USER_ENTITY_NAME, FAD.SEQ_NUM)';
OPEN C_ATTACHED FOR C_SQL;
FETCH C_ATTACHED
INTO VATTACHEDINFO;
WHILE C_ATTACHED%FOUND LOOP
V_DOCUMENT_ATTACHED := V_DOCUMENT_ATTACHED ||
'<tr>
<td align="LEFT" valign="baseline" class="x1l x4x">' ||
V_COUNT ||
'</td>
<td align="LEFT" valign="baseline" class="x1l x4x">' ||
VATTACHEDINFO.USER_ENTITY_NAME ||
'</td>
<td align="LEFT" valign="baseline" class="x1l x4x">' ||
VATTACHEDINFO.TITLE || '</td>
<td align="LEFT" valign="baseline" class="x1l x4x">
<a href="' ||
GET_OUTPUT_URL(V_PK1_VALUE,
VATTACHEDINFO.FILE_ID,
P_ENTITY_NAME) || '">' ||
VATTACHEDINFO.FILE_NAME || '</a></td>
</tr>';
V_COUNT := V_COUNT + 1;
FETCH C_ATTACHED
INTO VATTACHEDINFO;
END LOOP;
V_DOCUMENT_ATTACHED := V_DOCUMENT_ATTACHED ||
'</table></td></tr></table>';
RETURN V_DOCUMENT_ATTACHED;
EXCEPTION
WHEN OTHERS THEN
RETURN NULL;
END GET_ATTACHED_HTML;
----------------------------------------------------------------------------------
--功能名称:
-- GET_OUTPUT_URL
--功能说明:
-- 获取附件下载链接地址
--参数说明:
-- P_PK1_VALUE 附件的主关键字值
-- P_FILE_ID 附件文件ID
-- P_ENTITY_NAME 文档实体标识
-- 返回指定附件文件的下载链接地址
--版本信息:
-- 1.0 Initial Creation
----------------------------------------------------------------------------------
/*FUNCTION GET_OUTPUT_URL(P_PK1_VALUE IN NUMBER, P_FILE_ID IN NUMBER,P_ENTITY_NAME IN VARCHAR2)
RETURN VARCHAR2 IS
P_ACCESS_ID NUMBER;
V_OUTPUT_URL VARCHAR2(10000);
BEGIN
V_OUTPUT_URL := '';
SELECT ACCESS_ID
INTO P_ACCESS_ID
FROM FND_LOB_ACCESS
WHERE FILE_ID = P_FILE_ID;
V_OUTPUT_URL := RPT_REG_PKG.G_XML_PATH\*是一个配置文件值可以自己定义修改,值如:http://db1.dtpower.zszy.com:8001\*\ ||
'OA_HTML/fndgfm.jsp?mode=download_blob&fid=' ||
P_FILE_ID || '&accessid=' || P_ACCESS_ID;
RETURN V_OUTPUT_URL;
EXCEPTION
WHEN NO_DATA_FOUND THEN
INSERT INTO FND_LOB_ACCESS
(ACCESS_ID, FILE_ID, TIMESTAMP)
SELECT TO_NUMBER(TO_CHAR(FND_LOBS_S.NEXTVAL) ||
TO_CHAR(SYSDATE, 'SSSSS')),
D.MEDIA_ID,
SYSDATE + 1
FROM FND_ATTACHED_DOCUMENTS B,
FND_DOCUMENTS_TL C,
FND_DOCUMENTS D
WHERE B.DOCUMENT_ID = C.DOCUMENT_ID
AND B.DOCUMENT_ID = D.DOCUMENT_ID
AND B.PK1_VALUE = P_PK1_VALUE
AND D.MEDIA_ID = P_FILE_ID
AND B.ENTITY_NAME = P_ENTITY_NAME
AND C.LANGUAGE = 'ZHS';
COMMIT;
SELECT ACCESS_ID
INTO P_ACCESS_ID
FROM FND_LOB_ACCESS
WHERE FILE_ID = P_FILE_ID;
V_OUTPUT_URL := RPT_REG_PKG.G_XML_PATH ||
'OA_HTML/fndgfm.jsp?mode=download_blob&fid=' ||
P_FILE_ID || '&accessid=' || P_ACCESS_ID;
RETURN V_OUTPUT_URL;
WHEN OTHERS THEN
P_ACCESS_ID := 0;
V_OUTPUT_URL := '';
XZTZ_LOG_PKG.INSERT_LOG('附件列表文件下载链接生成异常',
SQLERRM,
'XZ_PO_PUB_PKG.GET_OUTPUT_URL',
30);
RETURN V_OUTPUT_URL;
END GET_OUTPUT_URL;*/
FUNCTION GET_OUTPUT_URL(P_PK1_VALUE IN NUMBER,
P_FILE_ID IN NUMBER,
P_ENTITY_NAME IN VARCHAR2) RETURN VARCHAR2 IS
P_ACCESS_ID NUMBER;
V_OUTPUT_URL VARCHAR2(10000);
BEGIN
/* V_SQL_STR := 'SELECT d.file_name,d.media_id ,a.access_id,
fnd_gfm.construct_download_url(fnd_web_config.gfm_agent,d.media_id) URL ' ||
' from fnd_attached_documents b,fnd_documents_tl c,fnd_lob_access a,fnd_documents d' ||
' where b.document_id=c.document_id and b.document_id=d.document_id and b.pk1_value=''' ||
V_PK1_VALUE || '''' ||
' and a.file_id=d.media_id and b.entity_name IN (''XZ_PO_EXPENDED'',''XZ_PO_EXPENDED'')
and C.LANGUAGE=''ZHS'' '; */
V_OUTPUT_URL := FND_GFM.CONSTRUCT_DOWNLOAD_URL(FND_WEB_CONFIG.GFM_AGENT, /*应用产品 Web 代理配置文件值:http://db1.dtpower.zszy.com:8001/pls/TEST*/
P_FILE_ID);
RETURN V_OUTPUT_URL;
EXCEPTION
WHEN OTHERS THEN
P_ACCESS_ID := 0;
V_OUTPUT_URL := '';
XZTZ_LOG_PKG.INSERT_LOG('附件列表文件下载链接生成异常',
SQLERRM,
'XZ_PO_PUB_PKG.GET_OUTPUT_URL',
30);
RETURN V_OUTPUT_URL;
END GET_OUTPUT_URL;
最终效果:
EBS获取附件URL的更多相关文章
- EBS开发附件上传和下载功能(转)
原文地址: EBS开发附件上传和下载功能 上传 Oracle ERP二次开发中使用的方式有两种,一是通过标准功能,在系统管理员中定义即可,不用写代码,就可以使几乎任何Form具有附件功能,具体参考系统 ...
- EBS OAF 发展 URL商标、加密和编码
EBS OAF 发展 URL商标.加密和编码 (版权声明.我原来的或翻译的文章,如需转载,转载的个人学习,转载请注明出处:否则,请与我联系.版权所有) 马克 当您指定页面定义声明URL参数,文本也能够 ...
- js获取页面url
设置或获取对象指定的文件名或路径. window.location.pathname例:http://localhost:8086/topic/index?topicId=361alert(windo ...
- 在ASP.NET MVC 中获取当前URL、controller、action
一.URL的获取很简单,ASP.NET通用: [1]获取 完整url (协议名+域名+虚拟目录名+文件名+参数) string url=Request.Url.ToString(); [2]获取 虚拟 ...
- Javascript 获取链接(url)参数的方法
有时我们需要在客户端获取链接参数,一个常见的方法是将链接当做字符串,按照链接的格式分解,然后获取对应的参数值.本文给出的就是这个流程的具体实现方法. 当然,我们也可以用正则直接匹配,文章中也给出了一个 ...
- javascript获取当前url
在WEB开发中,许多开发者都比较喜欢使用javascript来获取当前url网址,本文就此为大家总结一下比较常用获取URL的javascript实现代码,以下示例是前面为相应实现方法,后面是获取URL ...
- Asp.Net_Mvc_获取当前Url、Controller、Action
一.URL的获取很简单,ASP.NET通用: [1]获取 完整url (协议名+域名+虚拟目录名+文件名+参数) string url=Request.Url.ToString(); [2]获取 虚拟 ...
- 获取与Url链接相关的信息
以下结果的值以此示例为基础:http://www.x2y2.com:80/fisker/post/0703/window.location.html?ver=1.0&id=6#imhere j ...
- js、jquery获取当前url中各个参数
首先,先把获取各参数的方式再写一遍,相信大家都耳熟能详,就写几个常用的吧. 以此网址https://i.cnblogs.com/EditPosts.aspx?opt=1为例: 1. var url=w ...
随机推荐
- proc
1. /proc 下文件的内容是动态创建的,当文件可写时可用作控制和配置目的. 2. 在某个进程读取 /proc 文件时,内核会分配一个内存页,驱动程序通过这个内存页将数据返回到用户空间 (read( ...
- org.apache.cxf.interceptor.Fault: Unmarshalling Error: 意外的元素 (uri:"", local:"werks")。所需元素为(none)
警告: Interceptor for {http://impl.service.ws.cxf.com/}WsStkoServiceImplService#{http://service.ws.cxf ...
- c++中Socket编程(入门)
转载 :http://www.cnblogs.com/L-hq815/archive/2012/07/09/2583043.html 但该作者也是转载,国外网站翻译之作 本人在学习Socket编程时, ...
- Jmeter元件作用域
转载自飞测团队
- queue,stack的相互实现
Implement Queue using Stacks [抄题]: [思维问题]: [一句话思路]: 取头部.取出来的时候,用一个output来倒序 [输入量]:空: 正常情况:特大:特小:程序里处 ...
- .net调用web邮箱发送邮件(转载)
public static void SendEmail() { System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient( ...
- WCF的例子
Demo的 “Service端”以本机IIS为宿主,“Client端”以WebForm项目为例. 1.新建项目:WCF>WCF Service Application: 2.删除默认文件ISer ...
- hook进程
https://www.cnblogs.com/Leo_wl/p/3311279.html https://blog.csdn.net/u013761036/article/details/65465 ...
- [SoapUI] Command-Line Arguments
https://support.smartbear.com/readyapi/docs/soapui/running/automating/cli.html Use the test runner t ...
- linux 常用压缩打包和解压命令
## zcvf gzip jcvf bzip2 gunzip tar zxvf jxvf