8. How We Create a Dependent LOV in OAF

Part 2: Creating a List of Values (LOV) in an OAF Page

Introduction

This is the second and final part of the guide on creating a List of Values (LOV) in an Oracle Application Framework (OAF) page. In Part 1, we created the foundational objects: the workspace, project, OAF page, Application Module, View Object (SupplierVO), and the LOV Region (SupplierRG) with the ListOfValue style.

In this part, we will complete the LOV by:

  1. Adding a Table and Text Items to the LOV Region

  2. Creating a dedicated Application Module (SupplierAM) for the LOV Region

  3. Attaching the View Object to the LOV Application Module

  4. Binding the View Attributes to the LOV items

  5. Adding an Item to the main page with messagelovinput style

  6. Configuring the LOV Mapping to pass and return values

Part 1 Reference: https://rpforacle.blogspot.com/2013/03/creating-lov-in-oaf-page.html


Prerequisites

Before proceeding, ensure the following are complete from Part 1:

  • Workspace RohitLovCreation created

  • Project RohitLovCreation created

  • OAF Page RohitLovCreationPG created with PageLayoutRN region

  • Application Module RohitLovCreationAM created

  • View Object SupplierVO created under lov/server

  • LOV Region SupplierRG created under lov/webui with ListOfValue style


Step 1: Add a Table to the LOV Region

The LOV Region needs a table to display the query results in a structured, tabular format.

  1. Create the Table:

    • In the Structure window, right-click on SupplierRG

    • Select New → Table

    • A new region (region1) is created under SupplierRG

Note: This table will serve as the results grid in the LOV popup, displaying one row per supplier returned by the View Object query.


Step 2: Add Text Items to the Table

Inside the table region, we will add three text items to display supplier details. These items will be bound to attributes of the View Object.

  1. Create the First Item:

    • Right-click on region1 (inside SupplierRG)

    • Select New → messagestylestext

    • An item (item1) is created

  2. Create the Second Item:

    • Repeat the process to create item2

  3. Create the Third Item:

    • Repeat the process to create item3

Result: Three messagestylestext items are now created under the table region inside SupplierRG.


Step 3: Create the LOV Application Module (SupplierAM)

The LOV Region requires its own Application Module to manage access to the SupplierVO. This is separate from the main page's Application Module.

  1. Open the New Gallery:

    • Right-click on the project RohitLovCreation

    • Select New

  2. Select Application Module:

    • In the New Gallery, navigate to Business Tier → ADF Business Components

    • Select Application Module

    • Click OK

  3. Configure the Application Module:

    • Application Module Name: SupplierAM

    • Default Package: rohit.oracle.apps.fnd.RohitLovCreation.lov.server

Note: LOV Application Modules are typically created under the lov/server directory to keep LOV-related server objects organized.

  1. Add the View Object:

    • At Step 2 of the wizard, select SupplierVO from the Available list

    • Shuttle SupplierVO to the Selected list

    • Click Next, then click Finish

  2. Complete the Wizard:

    • The Application Module SupplierAM is now created with SupplierVO attached


Step 4: Attach the Application Module to the LOV Region

The LOV Region must be associated with SupplierAM so it can access the SupplierVO data.

  1. Select the Region:

    • In the Structure window, click on region1 (inside SupplierRG)

  2. Attach the Application Module:

    • In the Property Inspector (right-hand side), locate the Application Module property

    • Select SupplierAM from the dropdown list

Important: Without attaching SupplierAM to the LOV Region, the LOV popup will not be able to retrieve or display any data.


Step 5: Bind View Attributes to LOV Items

Now we must bind each text item in the LOV table to a specific attribute of the SupplierVO. This determines what data is displayed in each column of the LOV results grid.

  1. Configure Item1:

    • Click on item1

    • In the Property Inspector, set the following properties:

PropertyValue
View InstanceSupplierVO
View AttributeVendorName
  1. Configure Item2:

    • Click on item2

    • In the Property Inspector, set the following properties:

PropertyValue
View InstanceSupplierVO
View AttributeSegment1
  1. Configure Item3:

    • Click on item3

    • In the Property Inspector, set the following properties:

PropertyValue
View InstanceSupplierVO
View AttributeVendorId

Note: Each item now displays a different column from the SupplierVO query results. Item1 shows the vendor name, Item2 shows the supplier number (Segment1), and Item3 shows the vendor ID.


Step 6: Add an Item to the Main Page

Now we return to the main page (RohitLovCreationPG) to add the field that will trigger the LOV popup.

  1. Open the Main Page:

    • In the Application Navigator, open RohitLovCreationPG

  2. Create a New Region:

    • In the Structure pane, right-click on PageLayoutRN

    • Select New → Region

    • A new region (region1) is created under PageLayoutRN

  3. Create a New Item:

    • Right-click on region1

    • Select New → Item

    • An item (item1) is created under region1


Step 7: Configure the LOV Item

Now we configure the item on the main page to use the LOV.

  1. Select the Item:

    • Click on item1 in the Structure pane

  2. Set the Item Style:

    • In the Property Inspector, locate the ItemStyle property

    • Change the value to messagelovinput

Important: Setting ItemStyle=messagelovinput transforms the item into an LOV-enabled field, displaying the LOV icon next to it.

  1. Set the External LOV Path:

    • Locate the External LOV property in the Property Inspector

    • Enter the path to the LOV Region:

      text
      /rohit.oracle/apps/RohitLovCreation/lov/webui/supplierRG

Note: The External LOV path tells the page which LOV Region to open when the user clicks the LOV icon. The path follows the pattern: /<package_path>/<region_name>.


Step 8: Configure the LOV Mapping

The LOV Mapping defines how values are passed between the page item and the LOV Region. This is critical for the LOV to function correctly.

  1. Access the LOV Map:

    • With item1 selected, locate lovMap1 in the Structure pane

    • Click on lovMap1

  2. Configure the LOV Map Properties:

    • In the Property Inspector, set the following properties:

PropertyValueDescription
LOV Region Itemitem1The item in the LOV Region that returns the value
Criteria Itemitem1The item in the LOV Region used for search criteria
Return Itemitem1The field on the main page where the LOV returns the value

Explanation:

  • LOV Region Item: Specifies which item in the LOV Region provides the return value

  • Criteria Item: Specifies which item in the LOV Region is used to filter search results

  • Return Item: Specifies which field on the main page receives the selected value

Important: The Return Item determines where the LOV returns the value on the main page. In this example, the value is returned to item1 on the main page.


How the LOV Works at Runtime

The following illustrates the complete flow when a user interacts with the LOV:

  1. Page Load: The main page (RohitLovCreationPG) loads with the LOV item displayed

  2. User Clicks LOV Icon: The user clicks the LOV icon next to item1

  3. LOV Popup Opens: The SupplierRG region opens as a popup window

  4. Data Retrieval: SupplierAM executes the SupplierVO query

  5. Results Displayed: The table displays supplier data (VendorName, Segment1, VendorId)

  6. User Searches (Optional): The user can enter search criteria to filter results

  7. User Selects a Row: The user selects a supplier and clicks OK

  8. Value Returned: The selected value is returned to item1 on the main page via the LOV Mapping


Understanding the LOV Mapping

The LOV Mapping is the bridge between the main page item and the LOV Region. It defines three critical connections:

text
┌─────────────────────────────────────────────────────────────┐
│                    MAIN PAGE                                │
│  ┌─────────────────────────────────────────────────────┐   │
│  │  item1 (messagelovinput)                            │   │
│  │  ┌─────────────────────────────────────────────┐   │   │
│  │  │  Return Item ← value returned from LOV     │   │   │
│  │  └─────────────────────────────────────────────┘   │   │
│  └─────────────────────────────────────────────────────┘   │
└─────────────────────────────────────────────────────────────┘
                            │
                            ▼
┌─────────────────────────────────────────────────────────────┐
│                    LOV REGION (SupplierRG)                  │
│  ┌─────────────────────────────────────────────────────┐   │
│  │  Table Region                                       │   │
│  │  ┌──────────┐ ┌──────────┐ ┌──────────┐            │   │
│  │  │ item1    │ │ item2    │ │ item3    │            │   │
│  │  │VendorName│ │Segment1  │ │VendorId  │            │   │
│  │  └──────────┘ └──────────┘ └──────────┘            │   │
│  │                                                      │   │
│  │  LOV Region Item ──────────────────────────────────┐ │   │
│  │  Criteria Item ────────────────────────────────────┘ │   │
│  └─────────────────────────────────────────────────────┘   │
└─────────────────────────────────────────────────────────────┘
Mapping PropertyPurposeExample Value
LOV Region ItemThe item in the LOV Region that provides the return valueitem1
Criteria ItemThe item in the LOV Region used for filtering/searchingitem1
Return ItemThe field on the main page that receives the selected valueitem1

Best Practices

PracticeDescription
Use Dedicated LOV AMCreate a separate Application Module for the LOV Region
Organize LOV ObjectsKeep LOV VOs, Regions, and AMs in a dedicated lov directory
Use Meaningful NamesName items descriptively (e.g., SupplierNameItem, VendorIdItem)
Optimize VO QueriesEnsure the VO query returns only necessary columns for performance
Test the LOV MapVerify that values are returned to the correct page field
Handle Null SelectionsAdd logic to handle cases where the user cancels the LOV

Troubleshooting Common Issues

IssuePossible CauseSolution
LOV popup doesn't openWrong External LOV pathVerify the path matches the LOV Region location
LOV is emptyAM not attached or VO not addedAttach SupplierAM to SupplierRG and add SupplierVO
Wrong value returnedIncorrect LOV MappingVerify LOV Region Item, Criteria Item, and Return Item
LOV items show no dataView Attribute not boundBind each item to a valid View Attribute
Page won't compileMissing dependenciesRebuild the project and check for errors
LOV icon not appearingItemStyle incorrectVerify ItemStyle is set to messagelovinput

Summary

Completing the LOV in an OAF page involves the following key steps:

  1. Add a Table: Create a table region inside the LOV Region

  2. Add Text Items: Create three text items for displaying supplier data

  3. Create LOV Application Module: Create SupplierAM for the LOV Region

  4. Attach the View Object: Add SupplierVO to SupplierAM

  5. Attach the AM to the LOV Region: Associate SupplierAM with SupplierRG

  6. Bind View Attributes: Bind each item to a View Object attribute

  7. Add a Page Item: Create an item on the main page for the LOV

  8. Configure the LOV Item: Set ItemStyle to messagelovinput and the External LOV path

  9. Configure LOV Mapping: Define LOV Region Item, Criteria Item, and Return Item

By following these steps, you have created a fully functional LOV that allows users to search for and select a supplier from a database-driven list. The LOV component is one of the most powerful and frequently used UI elements in OAF development, and mastering it is essential for building robust, user-friendly Oracle E-Business Suite applications.

The modular architecture—with separate Application Modules for the main page and the LOV Region—ensures clean separation of concerns and makes the application easier to maintain and extend.


References

No comments:

Post a Comment