Saturday, May 25, 2013

Implement Dependent LOV in OA Framework

Let us try to create a Dependent LOV. In this exercise first Lov Input is “Employee Name” based on Employee Name Second Lov Input will give “Dependent Name”

1. Create a New Workspace and Project
Right click Workspaces and click create new OAworkspace and name it as PRajkumarDependentLovDemo.
Automatically a new OA Project will be created. Name the project as DependentLovDemo and package as prajkumar.oracle.apps.fnd.dependentlovdemo

Note -- Check Run Option Property for Project.
Right Click on DependentLovDemo > Oracle Applications > Run Options. Check OADeveloperMode should not be inSelected Options if it is there in Selected Options list then shuttle it back to Available Options


2. Create a New Application Module (AM)
Right Click on DependentLovDemo > New > ADF Business Components > Application Module
Name -- DependentLovAM
Package -- prajkumar.oracle.apps.fnd.dependentlovdemo.server

3. Create a New View Object (VO)
Right click on DependentLovDemo > New > ADF Business Components > View Object
Name – DependentLovVO1
Package -- prajkumar.oracle.apps.fnd.dependentlovdemo.server

Note - The VO is not based on any EO so click next and go to the query section and paste the query

SELECT  person_id, full_name
FROM     per_all_people_f
WHERE  SYSDATE BETWEEN effective_start_date AND effective_end_date

4. Create a New View Object for Second Lov (VO)
Right click on DependentLovDemo > New > ADF Business Components > View Object
Name – DependentLovVO2
Package -- prajkumar.oracle.apps.fnd.dependentlovdemo.server

Note - The VO is not based on any EO so click next and go to the query section and paste the query

SELECT  pcr.person_id, papf.full_name
FROM     per_contact_relationships pcr,
                per_all_people_f  papf
WHERE  papf.person_id  = pcr.contact_person_id
AND       SYSDATE  BETWEEN pcr.date_start AND NVL(pcr.date_end,SYSDATE)
AND       SYSDATE  BETWEEN papf.effective_start_date AND papf.effective_end_date

5. Add Your View Objects to Root UI Application Module
Select Right click on DependentLovAM > Edit DependentLovAM > Data Model >
Select DependentLovVO1 and DependentLovVO2 and shuttle to Data Model list


Create First LOV Region for VO DependentLovVO1

6. Create First LOV Region
Right click on DependentLovDemo > New > Web Tier > OA Components > Region
Name -- FirstLovRN
Package -- prajkumar.oracle.apps.fnd.dependentlovdemo.webui
Region Style -- listOfValues
Scope -- Public

Note - The property Scope is the key property which makes the LOV region public and makes it usable in multiple pages

7. Right click on FirstLovRN and click table using wizard. In the wizard choose the prajkumar.oracle.apps.fnd.dependentlovdemo.server.DependentLovAM and select DependentLovVO1_1. Click Next


Region Id – FirstLovRN
Region style – table


8. Shuttle the two attributes to the right side.That is PersonId and FullName


9. Set Region Item properties as below –

ID
Prompt
Style
Datatype
PersonId_LOV
PersonId
formValue
NUMBER
FullName_LOV
FullName
messageStyledText
VARCHAR2


10. Click Next and Finish

11. Select PersonId_LOV and Set Following Properties –

Attribute
Property
Search Allowed
False
Selective Search Criteria
False

12. Select FullName_LOV and Set Following Properties –

Attribute
Property
Search Allowed
True
Selective Search Criteria
False

Now Same way Create Second LOV Region for VO DependentLovVO2

13. Create Second LOV Region
Right click on DependentLovDemo > New > Web Tier > OA Components > Region
Name -- SecondLovRN
Package -- prajkumar.oracle.apps.fnd.dependentlovdemo.webui
Region Style -- listOfValues
Scope -- Public

Note - The property Scope is the key property which makes the LOV region public and makes it usable in multiple pages

14. Right click on SecondLovRN and click table using wizard. In the wizard choose the prajkumar.oracle.apps.fnd.dependentlovdemo.server.DependentLovAM and select DependentLovVO2_1. Click Next


Region Id – SecondLovRN
Region style – table


15. Shuttle the two attributes to the right side.That is PersonId and FullName


16. Set Region Item properties as below –

ID
Prompt
Style
Datatype
Second_PersonId_LOV
PersonId
messageStyledText
NUMBER
Second_FullName_LOV
FullName
messageStyledText
VARCHAR2



17. Click Next and Finish

18. Select Second_PersonId_LOV and Set Following Properties –

Attribute
Property
Search Allowed
False
Selective Search Criteria
True

19. Select Second_FullName_LOV and Set Following Properties –

Attribute
Property
Search Allowed
True
Selective Search Criteria
False

20. Create a New Page
Right click on DependentLovDemo > New > Web Tier > OA Components > Page

Attribute
Property
Name
DependentLovPG
Package
prajkumar.oracle.apps.fnd.dependentlovdemo.webui

21. Select the DependentLovPG and go to the strcuture pane where a default region has been created

22. Select region1 and set the following properties:

Attribute
Property
ID
PageLayoutRN
AM Definition
prajkumar.oracle.apps.fnd.dependentlovdemo.server.DependentLovAM
Window Title
Dependent List of values Demo Window
Title
Dependent List of values Demo

23. Right click PageLayoutRN and  click new Region

Attribute
Property
ID
MainRN
Region Style
messageComponentLayout

24. Create a New item to store Return result of First LOV and to give Search Criteria to second LOV
Select PageLayoutRN > New > Item
Set following Properties for New Item –

Attribute
Property
ID
ParentPersonId
Item Style
formValue
Data Type
Number

Build First LOV on Page:

25. Right click the MainRN and click new messageLovInput
Set Following Properties for Newly Created messageLovInput

Attribute
Property
ID
Employee_Name
External Lov
/prajkumar/oracle/apps/fnd/dependentlovdemo/webui/FirstLovRN
Search Allowed
False
Selective Search Criteria
True
Prompt
Employee Name

Select LovMap1 and set following properties --

Attribute
Property
Lov Region Item
FullName_LOV
Return Item
Employee_Name
Criteria Item
Employee_Name

Create LovMap2 and set following properties for that --
Select Employee_Name > lovMappings right click New > lovMap
Set following properties for lovMap2 --

Attribute
Property
Lov Region Item
PersonId_LOV
Return Item
ParentPersonId

Build Second LOV on Page:

26. Right click the MainRN and click new messageLovInput
Set Following Properties for Newly Created messageLovInput

Attribute
Property
ID
Dependent_Name
External Lov
/prajkumar/oracle/apps/fnd/dependentlovdemo/webui/SecondLovRN
Search Allowed
True
Selective Search Criteria
True
Prompt
Dependent Name

Select LovMap3 and set following properties --

Attribute
Property
Lov Region Item
Second_FullName_LOV
Return Item
Dependent_Name
Programmatic Query
True

Create LovMap4 and set following properties for that --
Select Dependent_Name > lovMappings right click New > lovMap
Set following properties for lovMap4 --

Attribute
Property
Lov Region Item
Second_PersonId_LOV
Criteria Item
ParentPersonId
Required
True

27. Congratulation you have successfully finished. Run Your page and Test Your Work










-------------------------------------------------------OR--------------------------------------------------------------



Creating Dependent Lov in OAF Page

In this Post we will try to create a Dependent Lov in "OAF" Page. I have Already Explain in my Privous Post that how we we can create Lov in OAF Page.So Now i m Started to create a Dependent Lov from there.Please Go through my Previous Post here Below is the link mentioned:

In the Below link You will find we have created a Supplier Lov in OAF Page.We will start creating Dependent Lov from there.

http://rpforacle.blogspot.com/2013/03/creating-lov-in-oaf-page.html

After Creating Supplier Lov in the Above Post mentioned in the Link Above.Now in this Post i will Create a Supplier Site Lov Which is Dependent on Supplier Lov Which is created In Above Link.So now I am going to start Dependent Lov .My workspace and Project will remain same which we have created in Above mentioned Link.

Create View Object(VO).

 Right Click on Project "RohitLovCreation".Click New.

Click on "View Object".Click ok.
View Object Name=SupplierSiteVO
Defualt Package="rohit.oracle.apps.RohitLovCreation.lov.server"

This VO is for LOV so to identify easily we we will create another directroy lov under the project directory as above.

Click Next and go to step 5 as below.

VO object has been created as below.

Now we create a Application Module.
Right Click on Project "RohitLovCreation".Click New.
Application Module wizard has open as below click next
Enter the Application Module name="SupplierSiteAM"

Defualt Package="rohit.oracle.apps.fnd.RohitLovCreation.lov.server"

we create "Application module" under the "Server" directory of the project as OAF Standard.


Go to Step 2 and Shuttle the View Object "SupplierSitesVO" to the right hand side.


Application Module has created as Below.
For Supplier Sites LOV We need to create another region.
So to create "Region" Right Click on the Project "RohitLovCreation".Click New.
Select Region and then OK.
 Region Name="SupplierSiteRG"
Default Package="rohit.oracle.apps.RohitLovCreation.lov.webui"
Style=ListOfValues
 Now region has created as below.
Now we attach the Application module to this Region.
AM Definition=rohit.oracle.apps.fnd.RohitLovCreation.lov.server.SupplierSitesAM
 Now Click on "SupplierSiteRG".Then go to Structure Pane Below  Click on Region "SupplierSiteRG".

Right Click on Region "SupplierSiteRG"=>Click New=>Click Table.
 Now Region1 has created under below region "SupplierSiteRG".

Right Click on region2 =>Click new=>Click messagestyledtext.
 Then item1 has created below under "region1".
PropertiesFor Item1
Prompt=Vendor Site Code
View Instance=SupplierSiteVO
View Attribute=VendorSiteCode


 Set Properties for item1
Set View Attribute
PropertiesFor Item2
Prompt=Vendor Site Id
View Instance=SupplierSiteVO
View Attribute=VendorSiteId

Now Click  on the Page "RohitLovCreationPG" and go to the Structure Pane and click on "Region1".
Right Click on Region1=>Click New=>Click Item.


Then Item2 has created Below.

Under Item1.There is "lovMapping" under this there is LovMap1 which we already created in Post Lov Creation.
Now Right Click on  "lovMapping"=>Click New=>Click lovmap.

Then lovmap2 has created under Lovmapping of item1.
Click on lovmap2 and then go the property window.
Set Properties Below

Again Right Click on Region1=>Click New=>Click Item.
 Then Item3 has created as below.
Click on item3 and then in right hand side in property window set some properties.
item Style=messagelovInput.
Now Under Item3.There is "lovMapping" under this there is LovMap.
Click on lovmap2 and then go the property window.
Set Properties Below

 Create Controller for a Main Page.
Now Click on "PageLayoutRN"=>Click setnewcontroller.
 Enter the Controller Name="RohitLovCreationCO"
Package="rohit.oracle.apps.fnd.RohitLovCreation.webui"

According to the OAF standard controller has creater under the webui of the project directory as shown above. Click Ok.
Now click on Region "SupplierSitesRG".and under Structure Pane.
Right Click on Region "SupplierSitesRG"=>Click setnewcontroller.

 Enter the Controller Name="SupplierSiteCO"
Package="rohit.oracle.apps.fnd.RohitLovCreation.lov.webui"

According to the OAF standard controller has creater under the webui of the project directory as shown above. Click Ok.
Then Controller has been created.

Now write code under the SupplierSiteAMIMPL.java class file.


    public void siteFilter(String vendorid)
    {
      OAViewObjectImpl oav=(OAViewObjectImpl)findViewObject("SupplierSiteVO");
   
      oav.setWhereClause("VENDOR_ID=:1");
   
      oav.setWhereClauseParam(0,vendorid);
   
    }



write Code under Process Form Request in RohitLovCreationCO Controller 
    OAApplicationModule am=pageContext.getApplicationModule(webBean);
  
    OADBTransaction  trx=am.getOADBTransaction();
  
  
    if (pageContext.isLovEvent())
       {
     
         String lovid=pageContext.getLovInputSourceId();
       
         if (lovid!=null && "item1".equalsIgnoreCase(lovid))
         {
          String vendor=(String)pageContext.getParameter("item2");
          trx.putValue("vendoridsession",vendor);
        
         }



write Code under Process Form Request in SupplierSiteCO Controller
    OAApplicationModule am=pageContext.getApplicationModule(webBean);
        OADBTransaction  trx=am.getOADBTransaction();

        String vendoridBasePage=(String)trx.getValue("vendoridsession");
   
      
        Serializable[] sp = {vendoridBasePage};
      
      
      
        am.invokeMethod("siteFilter",sp); 
      








OUTPUT IS BELOW







http://rpforacle.blogspot.in/2013/03/creating-dependent-lov-in-oaf-page.html



Set Default values CO Code.


OAApplicationModule am=(OAApplicationModule)pageContext.getApplicationModule(webBean);

OADBTransaction trx=(OADBTransaction)am.getOADBTransaction(); 
 Date val=(Date)trx.getCurrentDBDate();

String val1=pageContext.getUserName(); 

OAMessageTextInputBean textbean=(OAMessageTextInputBean)webBean.findIndexedChildRecursive("item1")
OAMessageTextInputBean textbean1=(OAMessageTextInputBean)webBean.findIndexedChildRecursive("item2");
textbean.setValue(pageContext,val);
textbean1.setValue(pageContext,val1); 
 After this rebuild your project like below.Right Click on the Project "DefualtValueAssign" and then click "Rebuild".

No comments:

Post a Comment