Here in this article I am going to share my another superb experience in OAF while working with Descriptive Flexfield (DFF) in an OA Page. At first I will take you all through how DFF are used in OA Page, then I will explain how it is enabled to work in OA Framework. As we all know Descriptive Flexfield(DFF) is used to capture extra information for a particular entity. To elaborate, While defining DFF, user has to configure the Reference Field with some oracle provided standard field name or profile name which can have multiple values defined in the system and for each values there will be an entry “Code” under “Context Field Values” section of that particular DFF. Again these Code will have different segmentsA�for capturing these extra information and moreover these segments has 1:1 mapping with the attribute columns of the concerned table where the data for that particular entity is saved normally. So DFF can be enabled from Oracle Forms and OA Pages setting appropriate value for the reference field of the DFF.
Problem Description:
Here I am going to explain two scenarios for DFF in OA Page:
Scenarion 1: How DFF can be enabled in Seeded OA Page if that DFF is already createdA�in the Seeded OA Page
When the page renders, Items of this page will have single item line displayed. But here Oracle has given provision to gather extra information about Invoice Line by creating an DFF flex, only requirement is to enable that DFF.
Our requirement is once page renders or new row is created by clicking “Add Row” button, DFF fields should be visible to the end users to get extra information about Invoice Line.
Scenarion 2:A�How DFF can be created and enabled in Seeded OA PageA�if it is not createdA�in the Seeded OA Page.
Lets take an example, once the page renders, “Shipping and Handling” section will have no rows,like:
But once “Add Row” button is clicked, one row will get create under “Shipping and Handling” section.
Our requirement was once the “Add Row” button is clicked under “Shipping and Handling” Section, DFF fields should be shown to have additional Information for the Invoice Charge Line. Here is the screenshot for the same:
Solution :
Scenario 1: Enable DFF in seeded OA PageA�When DFF is alreadyA�createdA�in the seeded OA Page
As DFF is already created in the seeded OA Page, so to enable the DFF only controller class of that page rather region has to be extended to write the logic. Here is the code below to enable the DFF.
// Method to enable Invoice Line DFF for each Invoice Lines
public void enableInvoiceLinesDFF()
{
InvoiceRequestAMImpl rootAM = (InvoiceRequestAMImpl)getRootApplicationModule();
OADBTransaction oadbtransaction = rootAM.getOADBTransaction();
OAViewObjectImpl apInvoiceLinesVOImpl = rootAM.getApInvoiceLinesVO();
ApInvoiceLinesVORowImpl apInvoiceLinesVORowImpl = null;
for (apInvoiceLinesVORowImpl = (ApInvoiceLinesVORowImpl)apInvoiceLinesVOImpl.first(); apInvoiceLinesVORowImpl != null; apInvoiceLinesVORowImpl = (ApInvoiceLinesVORowImpl)apInvoiceLinesVOImpl.next())
{
apInvoiceLinesVORowImpl.setAttributeCategory(Integer.toString(oadbtransaction.getOrgId()));
}
}
Scenario 2: Create and Enable DFF in Seeded OA Page
A. Personalization of OA Page to create DFF Flex at Site Level
- Navigation to Functional Administrator > Application Catalog
- Document Name: <page name with full specified path>
- Click on Go.
- Click on Personalize(Pencil) icon.
- Personalization Levels: Site Include Checked and Remove other Personalization Levels.
- Click Go
- Find the appropriate region and table name.
- Click on Create(Book) icon to create a Flex for that page providing mandatory field details like:
- ID of Flex: Unique Id of Flex in the concerned page.
- DFF Name: Short Name of the DFF against which flexmap will be created e.g: AP_INVOICE_LINES
- DFF’s Application Name: Application name of the DFF belongs to. e.g: SQLAP
- Display Context Field: Whether users are allowed to choose/switch the Context Value
- Segment List: List of fields user will be able to visualize for a specific context value
- Type of Flex: Descriptive/Key
- View Instance: EO based VO which will insert the data into database table(includes data entered in this DFF)
In the segment list, there is provision to select the segments that developer wants end user to enter. Suppose for Invoice Line DFF(Short Name: AP_INVOICE_LINES), reference field is ORG ID and for a particular context value of the reference field it contains 5 segments, say Segment1, Segment2, Segment3, Segment4, Segment5 and developer wants to show only two segments among these, lets say Segment2, Segment5 to end user, so developer has to put an entry in the segment list while creating flex in this manner <Context Field Value>|<Global Data Elements>|Segment1|..|SegmentN So, in our case, it will be <Value of Org Id>|Segment2|Segment5 Navigation:
Property | Value |
Level | Site |
Item Style | Flex |
ID | XX_INVOICE_CHARGE_LINE_DFF |
Additional Text | |
Admin Personalization | True |
Appl Short Name | SQLAP |
Attribute Set | |
CSS Class | |
Comments | |
Display Context Field | False |
Extends | |
Name | AP_INVOICE_LINES |
Prompt | |
Read Only | false |
Rendered | true |
Scope | |
Segment List | <Value of Org Id>|Segment2|Segment5 |
Type | Descriptive |
User Personalization | false |
View Instance | ApInvoiceChargeLinesVO |
Now, DFF Flex has been created it can be seen like:
B. Extension of Controller Class of the Page to write logic for enabling DFF:
Now Controller Class of this has to be extended to set value for Reference Field of the DFF, that is the attribute_category column of the concerned table which is nothing but the “AttributeCategory” attribute of the EO based VO created on that table. Here is the code snippet:
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processFormRequest(pageContext, webBean);
// Debugging Messages
if(pageContext.isLoggingEnabled(2))
pageContext.writeDiagnostics(this,”XXUnmatchedInvPGCO:processFormRequest:Entering into Custom Logic”,2);
// Get an instance of the AM
InvoiceRequestAMImpl rootAM = (InvoiceRequestAMImpl)pageContext.getApplicationModule(webBean);
// Get an instance of the Charge Line Table
OATableBean chargeLineTableBean = (OATableBean)webBean.findChildRecursive(“ChargeLinesTable”);
// If AddRows is clicked for Charge Lines
if ((chargeLineTableBean != null) && (chargeLineTableBean.getName(pageContext).equals(pageContext.getParameter(“source”))) && (“addRows”.equals(pageContext.getParameter(“event”))))
{
OAViewObjectImpl apInvoiceChargeLinesVOImpl = rootAM.getApInvoiceChargeLinesVO();
ApInvoiceChargeLinesVORowImpl apInvoiceChargeLinesVORowImpl = null;
for (apInvoiceChargeLinesVORowImpl = (ApInvoiceChargeLinesVORowImpl)apInvoiceChargeLinesVOImpl.first(); apInvoiceChargeLinesVORowImpl != null; apInvoiceChargeLinesVORowImpl = (ApInvoiceChargeLinesVORowImpl)apInvoiceChargeLinesVOImpl.next())
{
apInvoiceChargeLinesVORowImpl.setAttributeCategory(Integer.toString(pageContext.getOrgId()));
// Redirect to Current Page
pageContext.setForwardURLToCurrentPage(null, true, “Text”, (byte)0);
}
}
// Debugging Messages
if (pageContext.isLoggingEnabled(2))
pageContext.writeDiagnostics(this,”XXUnmatchedInvPGCO:processFormRequest:Exiting into Custom Logic”,2);
}
Please not that Charge Line table row gets created once “Add Row” button is clicked, so the logic is written when “Add Row” event is fired. Once the DFF is added in the Charge Line Table, the page has to be redirected to its own in order to reflect DFF fields.
It was all about integrating DFF in OA Framework. I hope this article help OAF developers to gather some valuable information on DFF in OA Framework.