You're reading...
Forms

How to add a Descriptive Flexfield (DFF) in a custom Oracle Apps form

In a previous article we have discussed how a custom DFF is registered in Oracle Apps. In this article I have demonstrated the process to add the DFF to a custom form.

Step 1: Create the custom table

We have created a custom table with the following script,

CREATE TABLE xx_supplier_blacklist ( blacklist_id NUMBER NOT NULL PRIMARY KEY,
                            supp_number VARCHAR2(30),
                            supp_name VARCHAR2(240),
                            address   VARCHAR2(1000),
                            LOCATION VARCHAR2(2),
                            supp_lob      VARCHAR2(240),
                            blklist_flag  VARCHAR2(3),
                            reason_blklist  VARCHAR2(240),
                            reason_details VARCHAR2(1000),
                            date_blklist   DATE,
                            date_remove  DATE,
                            reason_blk_remove VARCHAR2(240),
                            detail_reason_remove VARCHAR2(1000),
                            linkage VARCHAR2(3) ,
                            attribute_category  VARCHAR2(150),
                            attribute1  VARCHAR2(240),
                            attribute2  VARCHAR2(240),
                            attribute3  VARCHAR2(240),
                            attribute4  VARCHAR2(240),
                            attribute5  VARCHAR2(240)
                            )
/

We will use the attribute columns as our DFF segments


Step 2: Register the custom table

We need to register the custom table in Oracle since we need to add the attributes, attribute1..attribute5 as DFF.

You can refer to this article for registering the table. Once the table is registered you can check it on the front end.


Step 3: Register the DFF

You will find the registration steps in this article

The registered DFF will be this,

Segments

Click on Segments


Step 4: Configure Forms Builder

Forms builder has to be configured for developing Oracle Apps forms. You can find the steps in this article.


Step 5: Develop the custom form for Oracle Apps

You can follow the steps to develop a custom for Oracle Apps in this article.

We have created a new block named, XX_SUPPLIER_BLACKLIST. Add a new field in the block for the DFF.

We have named the field, DFF.

The important properties to be set are,

Subclass Information: TEXT_ITEM_DESC_FLEX

Required: No

Canvas: <Set the name of the Canvas manually since the item was created manually>

Database Item: No

Insert Allowed: Yes

Update Allowed: Yes

List of Values: ENABLE_LIST_LAMP

Validate From List: No

Notice the DFF text item on the canvas.

Now create a procedure in the form as given below,

PROCEDURE xx_supplier_blacklist_dff (event VARCHAR2)
IS
BEGIN
   IF (event = 'WHEN-NEW-FORM-INSTANCE')
   THEN
      fnd_descr_flex.define (BLOCK                         => 'XX_SUPPLIER_BLACKLIST', -- Name of the DFF
                             FIELD                         => 'DFF',
                             appl_short_name               => 'CUSTOM',
                             desc_flex_name                => 'BLACKLIST_FLEX'
                            );
   ELSE
      NULL;
   END IF;
END;

Now we need to add the call to this function when the form is initiated. Therefore we need to call the procedure from WHEN-NEW-FORM-INSTANCE. Open the WHEN-NEW-FORM-INSTANCE trigger.

Add the following line to call the inbuilt procedure,

xx_supplier_blacklist_dff ('WHEN-NEW-FORM-INSTANCE');

Finally we need to raise the event to call the DFF when the DFF field is clicked on. This will ensure that the DFF segments will be displayed.

Create a trigger, WHEN-NEW-ITEM-INSTANCE, on the block item named, DFF, and add the following line,

FND_FLEX.EVENT('WHEN-NEW-ITEM-INSTANCE');

Save the form and compile it on the server.

Note:
Oracle apps provides the API named, FND_FLEX, for Descriptive flexfield events. You can to write all the block level triggers to have consistent normal behaviour of the descriptive flexfield.

WHEN-VALIDATE-ITEM: FND_FLEX.EVENT(‘WHEN-VALIDATE-ITEM ‘);

PRE-QUERY: FND_FLEX.EVENT(‘PRE-QUERY’);

POST-QUERY: FND_FLEX.EVENT(‘POST-QUERY’);

WHEN-VALIDATE-ITEM: FND_FLEX.EVENT(‘WHEN-VALIDATE-RECORD’);

WHEN-NEW-ITEM-INSTANCE: FND_FLEX.EVENT(‘WHEN-NEW-ITEM-INSTANCE’);

PRE-INSERT: FND_FLEX.EVENT(‘PRE-INSERT’);

PRE-UPDATE: FND_FLEX.EVENT(‘PRE-UPDATE’);

You will find a new procedure in the Program Units section

The code in the procedure is,

PROCEDURE xx_supplier_blacklist_dff (event VARCHAR2)

IS

BEGIN

IF (event = ‘WHEN-NEW-FORM-INSTANCE’)

THEN

fnd_descr_flex.define (BLOCK => ‘XX_SUPPLIER_BLACKLIST’, — Name of the DFF

FIELD => ‘DFF’, — Field name

appl_short_name => ‘XXCUST’, — Custom Applications

desc_flex_name => ‘BLACKLIST_FLEX’

);

ELSE

NULL;

END IF;

END;

This procedure has been generated by Oracle for invoking the flex field window and its functionality.


Step 6: Register the form

Now we need to register the form in Oracle Applications

Responsibility: Application Developer

Navigation: Application > Form

Enter the form details

Form: XX_SUPPLIER_BLACKLIST

Application: Custom Applications

User Form Name: Supplier Blacklist form

Description: Supplier Blacklist form

Register the form function

Navigation: Application > Function

Description Tab

Enter the following:

Function: XX_SUPPLIER_BLACKLIST

User Function Name: Supplier Blacklist Func

Description: Supplier Blacklist function

Properties Tab

Type: Form

Form Tab

Form: Supplier Blacklist form

Save and close the form. Now the form is registered.


Step 7: Attach the form function to a menu/responsibility

After the form and the form functions are created we need to attach the form function to a menu that is attached to a responsibility. Once this is done the form will be accessible to us from that responsibility and other responsibilities which use that menu.

We would like to access the form from the responsibility named, IN AP Manager (HO). Let us open the responsibility form.

Responsibility: System Administrator

Navigation: Security > Responsibility > Define

Query for responsibility, IN AP Manager (HO).

Note the Menu name. It is AP_NAVIGATE_GUI12.

Navigate to Application > Menu.

Query for User Menu Name = AP_NAVIGATE_GUI12.

Scroll down to the bottom of the lines and add a line.

Enter,

Seq: 55

Prompt: Blacklist

Function: Supplier Blacklist Func

Description: Supplier Blacklist Function

Save and close the form. You will get a popup message saying that the menu us being recompiled. Now the form function is attached to the menu and will be accessible to us from the responsibility.


Test the form

Log in to Oracle and go to the responsibility, IN AP Manager (HO) as we had attached the form to the menu of this responsibility (Step 7).

Note the function, Blacklist, at the bottom of the navigation menu. Click on this function.

The form opens up. Now click on the DFF field on the bottom right.

Now the DFF form has also opened. Let us enter some values in the form as shown below.

Save the form. Query the data from the table and let us see if the data has been entered properly into the attribute columns. In this case we have setup only ATTRIBUTE1 as the DFF segment (Step 2).

Run the following query,

select blacklist_id, supp_number, supp_name, attribute_category, attribute1 from xx_supplier_blacklist

We can see that the DFF value has been entered properly into the table. The form is now enabled to use the DFF segment(s). You can make as many changes on the DFF segments and it will reflect on the form just like any Oracle seeded form.

Cheers!

About these ads

About Abhijit

I love sleeping, watching Hollywood blockbusters, my Wii, road trips and watching my 4 year old son grow up. In between I try to squeeze in some time to go to work.

Discussion

6 thoughts on “How to add a Descriptive Flexfield (DFF) in a custom Oracle Apps form

  1. very good article. Thanks for all your time…

    Posted by testuser | January 3, 2013, 6:02 am
  2. Hi Abhijit,
    With the help of your document, we were trying to invoke Globalization Flexfield JG_AP_INVOICES in our custom Invoice form. But seems, its not working and when I checked with my developer, he mentioned we need to write some code in custom.pll. Can you pls confirm if this is needed? Thanks in advance
    my email id is arvindstays@yahooo.co.in
    regards
    Arvind

    Posted by Arvind | March 20, 2013, 2:42 pm
    • Hi Arvind,

      Are you sure that the flexfield that you have enabled should be reflected with the transaction on that OAF page? There is no need for adding any custom code. It is just like enabling the DFF on any seeded form.

      Regards,
      Abhijit

      Posted by Abhijit Ray | March 21, 2013, 9:29 pm
      • Hi Abhijit,

        Yes, we tried step by step as per your guide. We are still struggling on this.
        The only difference seems to be definition of DFF. It is different from other DFFs like OU or Inventory Org context based. The context code has value – JE.HU.APXINWKB.TAX_DATE

        Preseeded DFF definition –
        Appln – Regional Localization
        Title – JG_AP_INVOICES
        Context, Reference Field – REFERENCE_FIELD
        Context Field values –
        Code, Name, Description
        JE.HU.APXINWKB.TAX_DATE, Additional Invoice Information, Additional Invoice Information

        any help on this would be highly appreciated.
        regards
        Arvind

        Posted by Arvind | March 22, 2013, 1:25 pm
      • I think the context is working well here. Better check that.

        -Arvind

        Posted by Abhijit Ray | March 25, 2013, 9:38 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Traffic

Site Stats

  • 683,644 views since Feb 2012

Archives

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 209 other followers

Flags

Free counters!
Follow

Get every new post delivered to your Inbox.

Join 209 other followers

%d bloggers like this: