Attachments in Oracle Form

34 篇文章 1 订阅

默认情况下“附件”按钮是灰显的,本文将展示如何让某个Form的附件按钮变亮,并能上传附件.

以用户Form为例,我们想让用户上传自己的照片

Pre-Setups

Help > Diagnostics > Custom Code > Personalize,记录下Function Name

并用Help > Diagnostics > Examine查看User Name字段和User ID字段对应的Field名称


我们将会在后边的步骤里使用USER_ID和USER_NAME


Setups

接下来就在Application Developer职责下,要配置Attachment

Step 1: Create document entity

Navigation: Application Developer > Responsibility > Attachments > Document Entities

(Entity:An entity is an object within Oracle Applications data, such as an item, an order, or anorder line. The attachments feature must be enabled for an entity before users can link attachments to the entity.)

Step 2: Create attachment function

Navigation: Application Developer > Responsibility > Attachment > Attachment Functions

选择Function,Name就是我们在文章刚开始时,查得的Function Name。再点Category,选择附件类型

Block,Entity为Block的名称

Entities


Step 3: Add document category

Navigation:Application Developer > Responsibility > Attachment > Document Categories

(Category:A document category is a label that users apply to individual attachments and documents. Document categories provide security by restricting the documents that can be viewed or added via a specific form or form function.
In the below example i am trying to enable the attachment funcionality for the USer form..I want to upload the approval copy for creating a user or attaching new responsibility)

Save the form. Click on Assignments button.
The default Type is Function. Add the name of the function, i.e. Users (This is the User Name of the function defined in Attachment Functions form).

这样附件的设置就算完成了。可以到用户form上,可以看到附件的按钮就变亮了。

点附件按钮,就可以上传附件了


上传之后

Query To Check


=================================================

Attachment Related Tables

1. FND_DOCUMENTS

2. FND_ATTACHED_DOCUMENTS

3. FND_DOCUMENTS_TL

4. FND_DOCUMENT_DATATYPES.

5. FND_DOCUMENT_CATEGORIES

6. FND_DOCUMENTS_LONG_TEXT (Long text type attachment).

7. FND_DOCUMENTS_SHORT_TEXT (Short text type attachment).

8. FND_DOCUMENTS_LONG_RAW

9. FND_LOBS (File type attachments).


FND_DOCUMENTS:

FND_DOCUMENTS stores language-independent information about a document. For example, each row contains a document identifier, a category identifier, the method of security used for the document (SECURITY_TYPE, where 1=Organization,2=Set of Books, 3=Business unit,4=None), the period in which the document is active, and a flag to indicate whether or not the document can be shared outside of the security type (PUBLISH_FLAG).

Other specifications in this table include: datatype (DATATYPE_ID, where 1=short text,2=long text, 3=image, 4=OLE object), image type, and storage type (STORAGE_TYPE, where 1=stored in the database, 2=stored in the file system).

The document can be referenced by many application entities and changed only in the define document form (USAGE_TYPE=S); it can be used as a fill-in-the-blanks document, where each time you use a template, you make a copy of it (USAGE_TYPE=T); or it can be used only one time (USAGE_TYPE=O).Images and OLE Objects cannot be used as templates.


FND_ATTACHED_DOCUMENTS:

FND_ATTACHED_DOCUMENTS stores information relating a document to an application entity.  For example, a record may link a document to a sales order or an item. Each row contains foreign keys to FND_DOCUMENTS and FND_DOCUMENT_ENTITIES. There is also a flag to indicate whether or not an attachment was created automatically.


FND_DOCUMENTS_TL:

FND_DOCUMENTS_TL stores translated information about the documents in FND_DOCUMENTS. Each row includes the document identifier, the language the row is translated to, the description of the document, the file in which the image is stored, and an identifier (MEDIA_ID) of the sub-table in which the document is saved (FND_DOCUMENTS_SHORT_TEXT, FND_DOCUMENTS_LONG_TEXT, or FND_DOCUMENTS_LONG_RAW).


FND_DOCUMENT_DATATYPES:

FND_DOCUMENT_DATATYPES stores the document datatypes that are supported. Initial values are: short text, long text, image, and OLE Object (DATATYPE_ID=1, 2, 3, or 4). Customers can add datatypes to handle documents stored outside of Oracle and use non-native Forms applications to view/edit their documents. The table uses a “duplicate record” model for handling multi-lingual needs. That is, for each category there will be one record with the same CATEGORY_ID and CATEGORY_NAME for each language.


FND_DOCUMENT_CATEGORIES:

FND_DOCUMENT_CATEGORIES stores information about the categories in which documents are classified. For example, documents may be considered “Bill of Material Comments”, “WIP Job Comments”, etc. Document categories are used to provide a measure of security on documents. Each form that enables the attachment feature lists which categories of documents can be viewed in the form. This table uses a “duplicate record” model for handling multi-lingual needs.


FND_DOCUMENTS_LONG_TEXT:

FND_DOCUMENTS_LONG_TEXT stores information about long text documents.


FND_DOCUMENTS_SHORT_TEXT:

FND_DOCUMENTS_SHORT_TEXT stores information about short text documents.


FND_DOCUMENTS_LONG_RAW:

FND_DOCUMENTS_LONG_RAW stores images and OLE Objects, such as Word Documents and Excel spreadsheets, in the database.


FND_DOCUMENT_ENTITIES:

FND_DOCUMENT_ENTITIES lists each entity to which attachments can be linked. For example, attachments can be linked to Items, Sales Orders, etc. Since the table uses a “duplicate record” model for handling multi-lingual needs, for each document entity there will be one record with the same DOCUMENT_ENTITY_ID and DATA_OBJECT_CODE for each language.


Useful Queries

To find all Long Text attachments:

  1. SELECT  
  2.         FAD.SEQ_NUM "Seq Number",  
  3.         FDAT.USER_NAME "Data Type",  
  4.         FDCT.USER_NAME "Category User Name",  
  5.         FAD.ATTACHED_DOCUMENT_ID "Attached Document Id",  
  6.         FDET.USER_ENTITY_NAME "User Entity",  
  7.         FD.DOCUMENT_ID "Document Id",  
  8.         FAD.ENTITY_NAME "Entity Name",  
  9.         FD.MEDIA_ID "Media Id",  
  10.         FD.URL "Url",  
  11.         FDT.TITLE "Title",  
  12.         FDLT.LONG_TEXT "Attachment Text"  
  13. FROM  
  14.         FND_DOCUMENT_DATATYPES FDAT,  
  15.         FND_DOCUMENT_ENTITIES_TL FDET,  
  16.         FND_DOCUMENTS_TL FDT,  
  17.         FND_DOCUMENTS FD,  
  18.         FND_DOCUMENT_CATEGORIES_TL FDCT,  
  19.         FND_ATTACHED_DOCUMENTS   FAD,  
  20.         FND_DOCUMENTS_LONG_TEXT FDLT  
  21. WHERE  
  22.         FD.DOCUMENT_ID          = FAD.DOCUMENT_ID  
  23.         AND FDT.DOCUMENT_ID     = FD.DOCUMENT_ID  
  24.         AND FDCT.CATEGORY_ID    = FD.CATEGORY_ID  
  25.         AND FD.DATATYPE_ID      = FDAT.DATATYPE_ID  
  26.         AND FAD.ENTITY_NAME     = FDET.DATA_OBJECT_CODE  
  27.         AND FDLT.MEDIA_ID       = FD.MEDIA_ID  
  28.         AND FDAT.NAME           = 'LONG_TEXT';  

To find all Short Text attachments:

  1. SELECT  
  2.         FAD.SEQ_NUM "Seq Number",  
  3.         FDAT.USER_NAME "Data Type",  
  4.         FDCT.USER_NAME "Category User Name",  
  5.         FAD.ATTACHED_DOCUMENT_ID "Attached Document Id",  
  6.         FDET.USER_ENTITY_NAME "User Entity",  
  7.         FD.DOCUMENT_ID "Document Id",  
  8.         FAD.ENTITY_NAME "Entity Name",  
  9.         FD.MEDIA_ID "Media Id",  
  10.         FD.URL "Url",  
  11.         FDT.TITLE "Title",  
  12.         FDST.SHORT_TEXT "Attachment Text"  
  13. FROM  
  14.         FND_DOCUMENT_DATATYPES FDAT,  
  15.         FND_DOCUMENT_ENTITIES_TL FDET,  
  16.         FND_DOCUMENTS_TL FDT,  
  17.         FND_DOCUMENTS FD,  
  18.         FND_DOCUMENT_CATEGORIES_TL FDCT,  
  19.         FND_ATTACHED_DOCUMENTS   FAD,  
  20.         FND_DOCUMENTS_SHORT_TEXT FDST  
  21. WHERE  
  22.         FD.DOCUMENT_ID          = FAD.DOCUMENT_ID  
  23.         AND FDT.DOCUMENT_ID     = FD.DOCUMENT_ID  
  24.         AND FDCT.CATEGORY_ID    = FD.CATEGORY_ID  
  25.         AND FD.DATATYPE_ID      = FDAT.DATATYPE_ID  
  26.         AND FAD.ENTITY_NAME     = FDET.DATA_OBJECT_CODE  
  27.         AND FDST.MEDIA_ID       = FD.MEDIA_ID  
  28.         AND FDAT.NAME           = 'SHORT_TEXT';  

WEBPAGE ATTACHMENT

  1. SELECT DISTINCT  
  2.   AD.SEQ_NUM                  ,  
  3.   DCT.USER_NAME               ,   
  4.   DAT.USER_NAME               ,  
  5.   D.STORAGE_TYPE              ,  
  6.   D.FILE_NAME                 ,  
  7.   D.IMAGE_TYPE                ,  
  8.   D.USAGE_TYPE                ,  
  9.   AD.AUTOMATICALLY_ADDED_FLAG ,  
  10.   AD.ATTACHED_DOCUMENT_ID     ,  
  11.   DET.USER_ENTITY_NAME        ,  
  12.   D.DATATYPE_ID               ,  
  13.   DAT.NAME                    ,  
  14.   D.DOCUMENT_ID               ,   
  15.   D.START_DATE_ACTIVE         ,  
  16.   D.END_DATE_ACTIVE           ,  
  17.   D.SECURITY_TYPE             ,  
  18.   D.SECURITY_ID               ,  
  19.   D.PUBLISH_FLAG              ,  
  20.   AD.CREATED_BY               ,  
  21.   DET.USER_ENTITY_PROMPT      ,  
  22.   AD.ENTITY_NAME              ,  
  23.   AD.COLUMN1                  ,  
  24.   AD.PK1_VALUE                ,   
  25.   D.MEDIA_ID                  ,  
  26.   D.CATEGORY_ID               ,  
  27.   D.URL                       ,  
  28.   DT.TITLE  
  29. FROM FND_DOCUMENT_DATATYPES DAT,  
  30.   FND_DOCUMENT_ENTITIES_TL DET    ,  
  31.   FND_DOCUMENTS_TL DT             ,  
  32.   FND_DOCUMENTS D                 ,  
  33.   FND_DOCUMENT_CATEGORIES_TL DCT  ,   
  34.   FND_ATTACHED_DOCUMENTS AD  
  35. WHERE D.DOCUMENT_ID        = AD.DOCUMENT_ID  
  36. AND DT.DOCUMENT_ID         = D.DOCUMENT_ID  
  37. AND DCT.CATEGORY_ID        = D.CATEGORY_ID  
  38. AND D.DATATYPE_ID          = DAT.DATATYPE_ID  
  39. AND AD.ENTITY_NAME         = DET.DATA_OBJECT_CODE  
  40. AND DAT.name               = 'WEB_PAGE';  

FILE ATTACHMENT

  1. SELECT  
  2.   AD.SEQ_NUM                  ,  
  3.   DCT.USER_NAME               ,   
  4.   DAT.USER_NAME               ,   
  5.   AD.ATTACHED_DOCUMENT_ID     ,  
  6.   DET.USER_ENTITY_NAME        ,   
  7.   DAT.NAME                    ,  
  8.   D.DOCUMENT_ID               ,   
  9.   AD.ENTITY_NAME              ,   
  10.   AD.PK1_VALUE                ,   
  11.   D.MEDIA_ID                  ,   
  12.   D.URL                       ,  
  13.   DT.TITLE                    ,  
  14.   DBMS_LOB.SUBSTR(L.file_data,1,10) file_data  
  15. FROM FND_DOCUMENT_DATATYPES DAT,  
  16.   FND_DOCUMENT_ENTITIES_TL DET    ,  
  17.   FND_DOCUMENTS_TL DT             ,  
  18.   FND_DOCUMENTS D                 ,  
  19.   FND_DOCUMENT_CATEGORIES_TL DCT  ,   
  20.   FND_ATTACHED_DOCUMENTS AD       ,  
  21.   FND_LOBS  L                           
  22. WHERE D.DOCUMENT_ID          = AD.DOCUMENT_ID  
  23. AND DT.DOCUMENT_ID           = D.DOCUMENT_ID  
  24. AND DCT.CATEGORY_ID          = D.CATEGORY_ID  
  25. AND D.DATATYPE_ID            = DAT.DATATYPE_ID  
  26. AND AD.ENTITY_NAME           = DET.DATA_OBJECT_CODE  
  27. AND L.FILE_ID                = D.MEDIA_ID  
  28. AND DAT.name                 = 'FILE';  

Find the functions using attachments

  1. SELECT  
  2.   AD.SEQ_NUM                  ,  
  3.   DCT.USER_NAME               ,   
  4.   DAT.USER_NAME               ,   
  5.   AD.ATTACHED_DOCUMENT_ID     ,  
  6.   DET.USER_ENTITY_NAME        ,   
  7.   DAT.NAME                    ,  
  8.   D.DOCUMENT_ID               ,   
  9.   AD.ENTITY_NAME              ,   
  10.   AD.PK1_VALUE                ,   
  11.   D.MEDIA_ID                  ,   
  12.   D.URL                       ,  
  13.   DT.TITLE                    ,  
  14.   AF.FUNCTION_NAME            ,  
  15.   AF.FUNCTION_TYPE               
  16. FROM FND_DOCUMENT_DATATYPES DAT,  
  17.   FND_DOCUMENT_ENTITIES_TL DET    ,  
  18.   FND_DOCUMENTS_TL DT             ,  
  19.   FND_DOCUMENTS D                 ,  
  20.   FND_DOCUMENT_CATEGORIES_TL DCT  ,  
  21.   FND_DOC_CATEGORY_USAGES DCU     ,  
  22.   FND_ATTACHMENT_FUNCTIONS AF     ,  
  23.   FND_ATTACHED_DOCUMENTS AD  
  24. WHERE 1 = 1  
  25. AND D.DOCUMENT_ID              = AD.DOCUMENT_ID  
  26. AND DT.DOCUMENT_ID             = D.DOCUMENT_ID  
  27. AND DCT.CATEGORY_ID            = D.CATEGORY_ID  
  28. AND DCU.CATEGORY_ID            = D.CATEGORY_ID  
  29. AND DCU.ATTACHMENT_FUNCTION_ID = AF.ATTACHMENT_FUNCTION_ID  
  30. AND D.DATATYPE_ID              = DAT.DATATYPE_ID  
  31. AND AD.ENTITY_NAME             = DET.DATA_OBJECT_CODE  
  32. AND DCU.ENABLED_FLAG           = 'Y';  



Reference

http://imdjkoch.wordpress.com/2010/09/02/attachment-in-oracle-application/

http://erpschools.com/articles/oracle-attachment-functionality-adding-an-attachment-to-a-form

http://oraclemaniac.com/2012/04/23/enable-attachment-button-for-an-oracle-apps-form/

http://www.centroid.com/knowledgebase/blog/how-to-enable-attachments-in-oracle-e-business-suite-release-12

http://oracleappstechnicalworld.blogspot.jp/2008/04/attachment-functionality-in-oracle.html

http://www.shareoracleapps.com/2010/06/fnd-attachments-in-oracle-apps-r12.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值