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 ...
随机推荐
- Java List/HashSet/HashMap的排序
在对Java无序类集合,如List(ArrayList/LinkedList).HashSet(TreeSet有序).HashMap等排序时,Java中一个公共的类Collections,提供了对Ja ...
- TZOJ 3533 黑白图像(广搜)
描述 输入一个n*n的黑白图像(1表示黑色,0表示白色),任务是统计其中八连块的个数.如果两个黑格子有公共边或者公共顶点,就说它们属于同一个八连块.如图所示的图形有3个八连块. 输入 第1行输入一个正 ...
- 合并区间 · Merge Intervals & 插入区间 · Insert Interval
[抄题]: 给出若干闭合区间,合并所有重叠的部分. 给出的区间列表 => 合并后的区间列表: [ [ [1, 3], [1, 6], [2, 6], => [8, 10], [8, 10] ...
- [leetcode]333. Largest BST Subtree最大二叉搜索树子树
Given a binary tree, find the largest subtree which is a Binary Search Tree (BST), where largest mea ...
- php自定义session存储路径
1.找到php.ini配置文件,找到session.save_path,修改如下: 其中2表示session存储的目录深度,也就是分目录,避免一个目录下文件太多,造成IO负担. session.sav ...
- pycharm中的常用快捷键
查找 Ctrl + F 替换 Ctrl + R 注释 Ctrl + / 去掉注释 Ctrl + / Function Shortcut Use this shortcut to... Clos ...
- POJ 1300.Door Man 欧拉通路
Door Man Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 2596 Accepted: 1046 Descript ...
- 获取GUID的GET网址:createguid.com
1.在浏览器的地址栏中输入createguid.com,回车之后即可得到一个GUID 2.在JMeter中可以这样填写HTTP Request 然后通过正则表达式提取器提取GUID <texta ...
- Zookeeper 系列(三)Zookeeper API
Zookeeper 系列(三)Zookeeper API 本节首先介绍 Zookeeper 的 Shell 命令,再对 Java 操作 Zookeeper 的三种方式进行讲解,本节先介绍 Zookee ...
- 实现KbmMw web server 支持https
在以前的文章里面介绍过kbmmw 做web server. 前几天红鱼儿非要我给他做一个支持https 的web server. 其实kbmmw 支持https 有好几种方法: 1. 使用isapi ...