Creating an OAF Page with FND Attachments
Sometimes clients have requirements to attach files (like
invoice copy etc.), this can be achieved using FND Attachments. Oracle provides
developers with a way to store files/attachments in Oracle via FND Attachments.
Below Diagram shows the tables involved in the
attachment functionality
In OAF the Attachment functionality is automatically handled
by the Attachment Beans, you can find more details for the same in OAF
Documentation guide (<Jdev Installation path>\jdevdoc\WebHelp\devguide\feat\feat_attach.htm).
Below i will demonstrate an example as to how to create an
OAF Page with Fnd Attachments.
1.>
Setups needed for including Fnd Attachment to an
OAF Page
Attachment references are stored in
FND_ATTACHED_DOCUMENTS, identified by the Entity Name, hence we will first need
to create an Entity and make sure it is mapped to our Table’s primary key. This
is necessary so that the link between our custom table and Fnd Attachment table
remains.
i. Login to Oracle Applications > Ak Html Forms
> Ak Entities
ii.
Click on Create Button
1.
Application: <<Give Custom Application
Name>> XXCUST Custom Application
2.
Entity Id: <<Give a unique name>>XXXHDRATTACH
3.
Table Name: <<Give a table name to which
you will be attaching an attachment>>XXCUSTOMSTG_TBL
4.
First PK
View Attribute Name: <<Give the primary key column name>>XXHEADER_ID
While Creating an Entity, it
creates a unique entity name and links it to our custom table’s primary key.
This is important as attachments are done for a record, if primary key is not
given we will not be able to trace the attachment for the entered record.
2.>
Create Attachment Bean in the Page
Below is a snapshot of my page for
which I had created an Attachment Bean, this will give an idea as to how to include
an Attachment bean in a page and to setting its mandatory properties.
a.
Create a Region > Add an attachmentLink >
Set ViewInstance Property with the VO which has the custom table and its
corresponding primary key.
b.
An entityMap1 gets generated by default, set
below properties for the same
Here Entity is the Entity name
given while creating the entity.
a.
Right click on item1 (AttachmentBean) > New
> Primary Key, it creates a default primaryKey1, set below values to the
properties
1.>
Running the Page and understanding the Default
Attachment Functionality
a.
If you have an update page for which an
attachment has already been added and if you are wondering how do we add
another attachment or replace the old one with new one, then let me tell this
functionality is automatically handled as a part of Attachment Bean. If you
open the same record from front end it will show you the file attached to it by
default and you can chose if you want to edit, remove, replace or continue with
the attachment.
I have set the “Automatic Save” property to
False, this will make sure I have a button with a commit transaction code
written in it, if you want to save the file on Add button click you can make
this property to True.
I suggest reading through the OAF
guide to understand all the properties of an Attachment and how you can use it
in your pages to tailor your custom needs
Feel free to drop your comments
and doubts (if any) and I will try to get back to you at the earliest.
Source :
Oracle OAF Documentation
Comments
Post a Comment