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’);
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’);
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
- Enter the following:
LOV VO Name: XXRDCountryLovVO
Package:A�xxrd.oracle.apps.ap.lov.server
VO Type: Read Only Access - Write the query.
- Uncheck all Impl and RowImpl java class generation as not required.
- Now Create AM for LOV. Enter the following:
AM Name: XXRDLovAM
Package:A�xxrd.oracle.apps.ap.lov.server - Shuffle XXRDCountryLovVO’s Instance XXRDCountryLovVO1 to enlist under XXRDLovAM.
- Uncheck the option to generate XXRDLovAMImpl java class
- Now create the external region. Navigation: Right Click on Project > OA Components > Region
- Enter
Region Name: XXRDCountryLovRN
Package: xxrd.oracle.apps.ap.lov.webui Style: listOfValues - Attach AM created for LOV and set scope as Public.
<<Attach image of scope as >> - Right Click on listOfValues Region to create table region.A�
- Right Click on table to add an Item.
ID: CountryName
Item Style: messageStyledText
Search Allowed:True
View Instance: XXRDCountryLovVO1
View Attribute: CountryName
Prompt: Country Name - 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>> - Next create a transient attribute in XXRDEmpVO. Enter
Name: CountryID
Type: String
Updatable: Always - And here’s how it looks:
- We have to create an item of type formValue as shown below:
ID: CountryIDFormVal
Item Style: formValue
View Instance: XXRDEmpVO1
View Attribute: CountryID - 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: Country - Next we have to create couple of LOV Maps which will map the messageLovInput item with items of the listOfValues Region.
First LovMap:
Second LovMap: - Launch the page.
- Verify data
- 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.
- Create BC4Js for State LOV.
Name: XXRDStateLovVO
Package: xxrd.oracle.apps.ap.lov.server - Enter the query.
- Uncheck all options for generating java classes.
- Attach the State Lov VO Instance (XXRDStateLovVO1) to Lov AM.
- Create Lov Region for State Lov.
Name: XXRDStateLovRN
Package: xxrd.oracle.apps.ap.lov.webui
Style: listOfValues - Right Click to add table region.
- 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: StateName - Add another item.
ID: StateIDFV
Item Style: formValue
View Instance: XXRDStateLovVO1
View Attribute: StateId - Add another item.
ID: CountryIdFV
Item Style: formValue
View Instance: XXRDStateLovVO1
View Attribute: CountryId - Finally it will look like:
- 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�State - Create LOV Mappings.<< state lov map >>
- Launch the page.
Hope this helps.