Wednesday, February 29, 2012

How to create a poplist item in OAF

To create a poplist item, you need a VO which would display the values in the poplist. Lets say we want to display a poplist which would display the values "Yes", "No" in the poplist.

  • Create a VO which would bring these values from the FND_LOOKUP_VALUES
    Add this new VO to the main AM

  • To use this VO, Create a new item in the Main Page with the Item Style as "MessageChoice"
  • Item Id: EnabledFlag
  • Select the appropriate data type
    Picklist View Instance:.EnabledFlagVO1 (This is the instance which populates the values in the
    Picklist Display Attribute: Meaning (This is the attribute from Poplist VO which would display
                                                the value in poplist
    Picklist Value Attribute: Code (This is the attribute value you would like to save in the database for
                                              for the main page)
    View Instance: This is the view instance of the Main Page from poplist item is being used.
    View Attribute: This is the attribute which would hold the value we chose from the poplist.
  • If you want to have a blank value displayed in the poplist, Set the "Add Blank Value" in the item properties to True.
  • If you want to display a specific value initially in the poplist when page is rendered.
    Set that value attribute in the "Initial Value" property.

Tuesday, February 28, 2012

How to create a external Lov region for Lov Input in OAF

Lets say you want to create a Lov Input for the Item "State" which would be used to select the states in USA while entering the Address.
For this first you would need a VO which would get all the States for USA.

  • Create a VO with the Select statement which gets all the USA States from the lookup
  • Create a new AM to attach the above created VO and then Attach the VO to the AM as shown below (Path:
    To attach the VO to AM: Select the StatesVO on the Left Side (Available View Objects) and Click on the Arrow as show below to move it to the Data Model side. This will create a new View Instance StatesVO1 of the parent object StatesVO. From here on we will be using this new instance which is attached to the AM not the Parent VO (StatesVO).

  • Now we have the VO to get the LOV Details is ready and AM to hold that VO is ready. Then we need an Independent Region which would be used to display the details for this LOV and Controller for that Region. To Create a new Region, Right Click on the Package and Select "New"
  • OA Components --> Region (Path:
  • Give the following properties to the Header Region (Top Region)
     1) Region Style: listofvalues
     2) AM Definition:
    Leave the other details to default  values
  • Right Click on the StatesRN and Navigate New --> New Region
    Assign the following properties to the New Child Region
     1) ID: MainRN
     2) Region Style: table
    Leave all other details to default.
  • Right Click on the MainRN and Navigate to Create 2 new items with the following properties
    Item 1:
    1) ID: StateCode
     2) Item Style: MessageStyledText
     3) Search Allowed: True
     4) Sort Allowed: True
     5) Datatype: VARCHAR2
     6) View Instance: StatesVO1
     7) View Attribute: LookupCode
     8) Prompt: State Code
    Leave all other values to default.
    Item 2:
    1) ID: State
     2) Item Style: MessageStyledText
     3) Search Allowed: False
     4) Sort Allowed: True
     5) Datatype: VARCHAR2
     6) View Instance: StatesVO1
     7) View Attribute: Meaning
     8) Prompt: State
    Leave all other values to default.
  • Two important properties in the above Region Items
    1. Search Allowed: For the Item when this Property value is set to True, In the LOV region when opened, User will be able to Search based on the Item.Let's say we have set the property to True for item "StateCode". So when the LOV Region is opened, we will be allowed to search based on the State Code as show below
    Because we haven't set the Search Allowed Property to True for Item "State", it is not showing up in the Search By Poplist.
    2. Sort Allowed: Sort Allowed Property will let the user sort the data by selected Column whose "Sort Allowed" property is set to True
  • Now our Region is Ready. Next Right Click on the Top Region and Select "Set New Controller"

    In the ProcessRequest Method of the Controler Include the following code as shown below, So that query is executed and data is populated in the LOV Region when clicked upon.
  • Create a new item in main of the page in which you want to see the LOV region.Set the item style to MessageLovInput. As soon as you change the item style, you will see a new region under the Lov item. Also you will find a lovMappings item created along with the region.You can delete the new region created by Lov as we would be using the External Region to display Lov values.
    Set the following properties as shown below for the Lov Item.

  • To use the External Lov region populate the External Lov field with the Region that was created previously (Complete Path). Set the Sort Allowed propety to "No"
  • Click on the lovMap1 created under LovMappings. Set the appropriate id for the lovMap1.
    Following properties are important for this lov to work.
    LovRegionItem: This is the value that you want to store in the database or use from the Lov region.
    ReturnItem: Give the Item ID from the current region where you want to have the value from the
                          Lov stored.
    CriteriaItem: Give the same value as ReturnItem.

  • Rebuild the page and run the page to have the Lov displayed next to the "State" Item in the page