Enable attachment button for an Oracle Apps formPosted by Abhijit Ray ⋅ April 23, 2012 ⋅ 13 Comments Filed Under attachment function, block declaration, document categories, document entity, entity declaration
All Oracle forms are not enabled to accept attachments, by default. We can enable the forms so that we can attach documents, URL, and also text as attachments for each record/transaction. I have demonstrated how to setup this functionality for the User form in Oracle.
If we open the User form, prior to setup, we shall find the attachment button disabled.
Since we shall enable the form to accept attachment we shall get some information about the form which is need for configuring attachments.
Click on Help > Diagnostics > Custom Code > Personalize. Note the Function Name
Close the Personalize form. Now we need to check the block and exact field names for USER_ID and USER_NAME fields as these will be configured later.
Click on Help > Diagnostics > Examine
Change the field to USER_ID
Change the field to USER_NAME
We shall use USER_ID and USER_NAME fields later on. Close the form
Setup steps
Responsibility: Application Developer. All configurations will be done in this responsibility.
Step 1: Create document entity
Navigation: Attachment > Document Entities
Create a new record
Table: FND_USER
Entity ID: FND_USER
Entity Name: User
Prompt: User
Application: System Administration
Save and close form
Step 2: Create attachment function
Navigation: Attachment > Attachment Functions
Create a new record
Type: Function
Name: FND_FNDSCAUS (This is the function name as setup on the Functions form)
User Name: Users (This value is populated automatically by Oracle when the function name is selected)
Enabled: Checked
Click on Categories button.
You can add as many categories you like. We shall add 2 categories, Web and Documents.
Close this window and go back to the mail form. Click on Blocks button.
Create a new record.
Block Name: User (We had picked this value from the form earlier)
Secured By: None
Context 1: USER.USER_NAME (BLOCK.FIELD_NAME from the User form)
Click on Entities button. Enter the values
1. Entity: User (from the LOV)2. Display Method: Main Entity3. Include in Indicator: Checked4. Include in View: Unchecked
Privileges tab
Query: Always
Insert: Always
Update: Always
Delete: Always
Click on Primary Key Fields tab
Primary Key Fields tab
Enter Key 1 as USER.USER_ID. This is the primary key of the main block.
Save the and close the form.
Step 3: Add document category
Navigation: Attachment > Document Categories
Create a new record
Category: User
Default Datatype: File (It can be any option from the LOV. Add if you require it as this field can be blank as well)
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).
Save and close the form
Test the functionality
Open the User form.
Now the attachment button is enabled. We shall attach a document for a user. Query for user SA1.
Now click on the attachment icon on the menu. The attachment form opens. Check the values available for Categories. We had enabled Web and Documents categories this form function. We get to pick only these 2 values.
We shall select category, Web and choose Data Type as File
Click on Browse button and select a file.
Click on Open
Click on Submit
Now close this window and go back to the form
Click on Yes button. Check the Source tab
Save and close this window.
We can check the attached document in the database as well. Connect to the database and execute the following query,
123
SELECT attached_document_id, document_id, seq_num, entity_name, pk1_value, category_idFROM fnd_attached_documentsWHERE entity_name = 'FND_USER' AND pk1_value = (select user_id from fnd_user where user_name = 'SA1')
The uploaded document is attached to the record by the user_id (pk1_value). The form will now accept documents for all users on the user form.
Note: ENTITY_NAME field in the table FND_ATTACHED_DOCUMENTS has the same value as the Entity ID entered on Attachment Entity form in Step 1.
Cheers!