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:
Adding a Table and Text Items to the LOV Region
Creating a dedicated Application Module (SupplierAM) for the LOV Region
Attaching the View Object to the LOV Application Module
Binding the View Attributes to the LOV items
Adding an Item to the main page with
messagelovinputstyleConfiguring the LOV Mapping to pass and return values
Part 1 Reference: https://docodi.blogspot.com/p/6-how-to-create-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/serverLOV Region SupplierRG created under
lov/webuiwithListOfValuestyle
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.
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.
Create the First Item:
Right-click on region1 (inside SupplierRG)
Select New → messagestylestext
An item (item1) is created
Create the Second Item:
Repeat the process to create item2
Create the Third Item:
Repeat the process to create item3
Result: Three
messagestylestextitems 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.
Open the New Gallery:
Right-click on the project RohitLovCreation
Select New
Select Application Module:
In the New Gallery, navigate to Business Tier → ADF Business Components
Select Application Module
Click OK
Configure the Application Module:
Application Module Name:
SupplierAMDefault 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.
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
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.
Select the Region:
In the Structure window, click on region1 (inside SupplierRG)
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.
Configure Item1:
Click on item1
In the Property Inspector, set the following properties:
| Property | Value |
|---|---|
| View Instance | SupplierVO |
| View Attribute | VendorName |
Configure Item2:
Click on item2
In the Property Inspector, set the following properties:
| Property | Value |
|---|---|
| View Instance | SupplierVO |
| View Attribute | Segment1 |
Configure Item3:
Click on item3
In the Property Inspector, set the following properties:
| Property | Value |
|---|---|
| View Instance | SupplierVO |
| View Attribute | VendorId |
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.
Open the Main Page:
In the Application Navigator, open RohitLovCreationPG
Create a New Region:
In the Structure pane, right-click on PageLayoutRN
Select New → Region
A new region (region1) is created under PageLayoutRN
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.
Select the Item:
Click on item1 in the Structure pane
Set the Item Style:
In the Property Inspector, locate the ItemStyle property
Change the value to messagelovinput
Important: Setting
ItemStyle=messagelovinputtransforms the item into an LOV-enabled field, displaying the LOV icon next to it.
Set the External LOV Path:
Locate the External LOV property in the Property Inspector
Enter the path to the LOV Region:
/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.
Access the LOV Map:
With item1 selected, locate lovMap1 in the Structure pane
Click on lovMap1
Configure the LOV Map Properties:
In the Property Inspector, set the following properties:
| Property | Value | Description |
|---|---|---|
| LOV Region Item | item1 | The item in the LOV Region that returns the value |
| Criteria Item | item1 | The item in the LOV Region used for search criteria |
| Return Item | item1 | The 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
item1on the main page.
How the LOV Works at Runtime
The following illustrates the complete flow when a user interacts with the LOV:
Page Load: The main page (
RohitLovCreationPG) loads with the LOV item displayedUser Clicks LOV Icon: The user clicks the LOV icon next to item1
LOV Popup Opens: The SupplierRG region opens as a popup window
Data Retrieval: SupplierAM executes the SupplierVO query
Results Displayed: The table displays supplier data (VendorName, Segment1, VendorId)
User Searches (Optional): The user can enter search criteria to filter results
User Selects a Row: The user selects a supplier and clicks OK
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:
┌─────────────────────────────────────────────────────────────┐
│ 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 Property | Purpose | Example Value |
|---|---|---|
| LOV Region Item | The item in the LOV Region that provides the return value | item1 |
| Criteria Item | The item in the LOV Region used for filtering/searching | item1 |
| Return Item | The field on the main page that receives the selected value | item1 |
Best Practices
| Practice | Description |
|---|---|
| Use Dedicated LOV AM | Create a separate Application Module for the LOV Region |
| Organize LOV Objects | Keep LOV VOs, Regions, and AMs in a dedicated lov directory |
| Use Meaningful Names | Name items descriptively (e.g., SupplierNameItem, VendorIdItem) |
| Optimize VO Queries | Ensure the VO query returns only necessary columns for performance |
| Test the LOV Map | Verify that values are returned to the correct page field |
| Handle Null Selections | Add logic to handle cases where the user cancels the LOV |
Troubleshooting Common Issues
| Issue | Possible Cause | Solution |
|---|---|---|
| LOV popup doesn't open | Wrong External LOV path | Verify the path matches the LOV Region location |
| LOV is empty | AM not attached or VO not added | Attach SupplierAM to SupplierRG and add SupplierVO |
| Wrong value returned | Incorrect LOV Mapping | Verify LOV Region Item, Criteria Item, and Return Item |
| LOV items show no data | View Attribute not bound | Bind each item to a valid View Attribute |
| Page won't compile | Missing dependencies | Rebuild the project and check for errors |
| LOV icon not appearing | ItemStyle incorrect | Verify ItemStyle is set to messagelovinput |
Summary
Completing the LOV in an OAF page involves the following key steps:
Add a Table: Create a table region inside the LOV Region
Add Text Items: Create three text items for displaying supplier data
Create LOV Application Module: Create SupplierAM for the LOV Region
Attach the View Object: Add SupplierVO to SupplierAM
Attach the AM to the LOV Region: Associate SupplierAM with SupplierRG
Bind View Attributes: Bind each item to a View Object attribute
Add a Page Item: Create an item on the main page for the LOV
Configure the LOV Item: Set ItemStyle to
messagelovinputand the External LOV pathConfigure 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
Oracle E-Business Suite Documentation: OA Framework Developer's Guide
Oracle JDeveloper Documentation: Available in the
jdevdocfolderOracle Application Framework: Official Oracle documentation
Related Guides: Creating a Pop List in OAF, Assigning Default Values in OAF
No comments:
Post a Comment