Implement LOV(List of Values) and Dependent LOV in OAF

In this article we will see how to implement LOV and Dependent LOV in OAF.

Database Design

Table Script

CREATE TABLE XXRD_COUNTRIES
(
COUNTRY_ID NUMBER,
COUNTRY_NAME VARCHAR2(20 BYTE)
);

CREATE TABLE XXRD_STATES
(
COUNTRY_ID NUMBER,
STATE_ID NUMBER,
STATE_NAME VARCHAR2(20 BYTE)
);

Data Script

INSERT INTO XXRD_COUNTRIES VALUES (1,’US’);
INSERT INTO XXRD_COUNTRIES VALUES (2,’IND’);
INSERT INTO XXRD_COUNTRIES VALUES (3,’UK’);country_data_db

INSERT INTO XXRD_STATES VALUES (1,100,’CA’);
INSERT INTO XXRD_STATES VALUES (1,101,’VA’);
INSERT INTO XXRD_STATES VALUES (1,102,’NJ’);

INSERT INTO XXRD_STATES VALUES (2,200,’KA’);
INSERT INTO XXRD_STATES VALUES (2,201,’WB’);
INSERT INTO XXRD_STATES VALUES (2,202,’DL’);

INSERT INTO XXRD_STATES VALUES (3,300,’LONDON’);
INSERT INTO XXRD_STATES VALUES (3,301,’NORWICH’);
INSERT INTO XXRD_STATES VALUES (3,302,’WESTHAMP’);state_data_db

Ideally, LOVs are created for Master Data which can be set in Lookup or Value set in EBS. Here to make the project simple, I have created couple of tables one for storing country and another for state. Now let’s see how we implement LOV. We will create External regions for LOVs and include those in the main page.

At first we will have to View Objects for LOV and then followed by Application Module for attaching VOs of LOV and external list of values region.

We will maintain different directory structure for LOV,A�say

BC4J’s for LOVs will be placed under: xxrd.oracle.apps.ap.lov.server

Region of LOV will be placed under: xxrd.oracle.apps.ap.lov.webui

  1. Enter the following:
    LOV VO Name: XXRDCountryLovVO
    Package:A�xxrd.oracle.apps.ap.lov.server
    VO Type: Read Only Accesscountrylovvo1
  2. Write the query.countrylovvo2
  3. Uncheck all Impl and RowImpl java class generation as not required.countrylovvo3
  4. Now Create AM for LOV. Enter the following:
    AM Name: XXRDLovAM
    Package:A�xxrd.oracle.apps.ap.lov.serverlovam
  5. Shuffle XXRDCountryLovVO’s Instance XXRDCountryLovVO1 to enlist under XXRDLovAM.lovam1
  6. Uncheck the option to generate XXRDLovAMImpl java classlovam2
  7. Now create the external region. Navigation: Right Click on Project > OA Components > Regionexternal_region1
  8. Enter
    Region Name: XXRDCountryLovRN
    Package: xxrd.oracle.apps.ap.lov.webui Style: listOfValuesexternal_region_countrylovrn2
  9. Attach AM created for LOV and set scope as Public.
    <<Attach image of scope as >>
  10. Right Click on listOfValues Region to create table region.A�external_region_countrylovrn4
  11. Right Click on table to add an Item.
    ID: CountryName
    Item Style: messageStyledText
    Search Allowed:True
    View Instance: XXRDCountryLovVO1
    View Attribute: CountryName
    Prompt: Country Nameexternal_region_countrylovrn5_111
  12. Similarly right click on table region to add CountryID of type formValue.
    ID: CountryIDFV
    Item Style: formValue
    View Instance: XXRDCountryLovVO1
    View Attribute: << attach image for form value>>
  13. Next create a transient attribute in XXRDEmpVO. Enter
    Name: CountryID
    Type: String
    Updatable: Alwaystransientattr_create
  14. And here’s how it looks:transientattr_create1
  15. We have to create an item of type formValue as shown below:
    ID: CountryIDFormVal
    Item Style: formValue
    View Instance: XXRDEmpVO1
    View Attribute: CountryIDlovitem_3
  16. Now, in the original page, right click on CreateRN to create a messageLovInput item for Country.
    ID: Country
    Item Style: messageLovInput
    External LOV: /xxrd/oracle/apps/ap/lov/webui/XXRDCountryLovRN
    View Instance: XXRDEmpVO1
    View Attribute: Country
    Prompt: Countrylovitem_1
  17. Next we have to create couple of LOV Maps which will map the messageLovInput item with items of the listOfValues Region.
    First LovMap:
    lovitem_2Second LovMap:lovitem_4
  18. Launch the page.
    lov_output1
  19. Verify datalov_output2
  20. We are going to implement Dependent LOV now. that does mean only the States corresponding to a Country being selected will be shown in the LOV. In short State LOV is dependent on Country LOV.
  21. Create BC4Js for State LOV.
    Name: XXRDStateLovVO
    Package: xxrd.oracle.apps.ap.lov.serverstatelov1
  22. Enter the query.statelov2
  23. Uncheck all options for generating java classes.statelov3
  24. Attach the State Lov VO Instance (XXRDStateLovVO1) to Lov AM.lovam1
  25. Create Lov Region for State Lov.
    Name: XXRDStateLovRN
    Package: xxrd.oracle.apps.ap.lov.webui
    Style: listOfValuesstatelovrn1
  26. Right Click to add table region.
  27. In the table region, add three items viz. one messageStyledText and couple of formValue.
    ID: Statename
    Item Style: messageStyledText
    Search Allowed: True
    View Instance: XXRDStateLovVO1
    View Attribute: StateNamestatelovrn3
  28. Add another item.
    ID: StateIDFV
    Item Style: formValue
    View Instance: XXRDStateLovVO1
    View Attribute: StateIdstatelovrn4
  29. Add another item.
    ID: CountryIdFV
    Item Style: formValue
    View Instance: XXRDStateLovVO1
    View Attribute: CountryIdstatelovrn5
  30. Finally it will look like:lovregion_final
  31. Now in the main page, add messageLovInput Item, State.
    ID: State
    Item Style: messageLovInput
    External LOV: /xxrd/oracle/apps/ap/lov/webui/XXRDStateLovRN
    View Instance: XXRDEmpVO1
    View Attribute: State
    Prompt: A�Statelovitem_5
  32. Create LOV Mappings.<< state lov map >>
    lovitem_6
  33. Launch the page.lov_output3 lov_output4

Hope this helps.

Leave a Reply

Your email address will not be published. Required fields are marked *

Show my latest post here