Top Banner
OAF Useful Tips By Manoj Madhusoodanan on Apr 29, 2012 Following are some useful tips in OAF development. How to deploy OAF page/region to MDS? java oracle.jrad.tools.xml.importer.XMLImporter fullpathname/XMLfilename.xml -username apps -password apps_password -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp) (HOST=host_name)(PORT=1531))(CONNECT_DATA=(SID=VISION)))" -rootdir $JAVA_TOP What are the mandatory steps to deploy a OAF page or region? a) Copy all files except page definition from local machine to appropriate directories. b) Copy page definition to $CUST_TOP/mds c) Call java importer d) Create form function with property "SSWA jsp function" and webhtml "OA.jsp? page=fullpath/XMLfilename". e) Add function to menu f) Add menu to responsibility g) Bounce the server How to bounce Apacthe server in R12? sh $INST_TOP/admin/scripts/adoacorectl.sh stop sh $INST_TOP/admin/scripts/adoacorectl.sh start How to bounce Apacthe server in 11i? sh $COMMON_TOP/admin/scripts/adapcctl.sh stop sh $COMMON_TOP/admin/scripts/adapcctl.sh start How to get page or region contents from MDS repository? BEGIN jdr_utils.printDocument('/manoj/oracle/apps/fnd/framework/toolbox/tutorial/webui/
28
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: OAF Tips

OAF Useful Tips

By Manoj Madhusoodanan on Apr 29, 2012

Following are some useful tips in OAF development.

How to deploy OAF page/region to MDS?

java oracle.jrad.tools.xml.importer.XMLImporter fullpathname/XMLfilename.xml -username apps -password apps_password -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=host_name)(PORT=1531))(CONNECT_DATA=(SID=VISION)))" -rootdir $JAVA_TOP

What are the mandatory steps to deploy a OAF page or region?

a) Copy all files except page definition from local machine to appropriate directories. b) Copy page definition to $CUST_TOP/mds c) Call java importer d) Create form function with property "SSWA jsp function" and webhtml "OA.jsp?page=fullpath/XMLfilename". e) Add function to menu f) Add menu to responsibility g) Bounce the server

How to bounce Apacthe server in R12?

sh $INST_TOP/admin/scripts/adoacorectl.sh stop

sh $INST_TOP/admin/scripts/adoacorectl.sh start

How to bounce Apacthe server in 11i?

sh $COMMON_TOP/admin/scripts/adapcctl.sh stop

sh $COMMON_TOP/admin/scripts/adapcctl.sh start

How to get page or region contents from MDS repository?

BEGIN jdr_utils.printDocument('/manoj/oracle/apps/fnd/framework/toolbox/tutorial/webui/HelloWorldPG',1000);END;

Delete Records in OAF Page

Page 2: OAF Tips

By PRajkumar on Apr 29, 2012

1. Create a Search Page to Create a page please go through the following link

https://blogs.oracle.com/prajkumar/entry/create_oaf_search_page

2. Implement a Delete in your SearchEOImpl Class

public void remove() { super.remove(); } // end remove()

3. Create a Delete Image

Select ResultsTable right click > New > Item

Set following properties for New Item

ID – DeleteAction

Item Style – image

Image URI – deleteicon_enabled.gif

Atribute Set -- /oracle/apps/fnd/attributesets/Buttons/Delete

Prompt -- Delete

Additional Text – Delete record action enabled

Height – 24

Width – 24

Action Type – fireAction

Event – delete

Submit – True

Select Parameter Properties define parameter name as Column1 and whose value is

${oa.SearchVO1.Column1}

Select Parameter Properties define parameter name as Column2 and whose value is

Page 3: OAF Tips

${oa.SearchVO1.Column2}

Select OK button to create your request parameters

4. Add Page Controller

Add a New Contoller for SearchPG

Name – SearchCO

Package -- prajkumar.oracle.apps.fnd.searchdemo.webui

Implement Delete Action

5. Add deleteRecord() method to SearchAMImpl

import oracle.apps.fnd.framework.OAViewObject; import oracle.apps.fnd.framework.server.OAApplicationModuleImpl; import oracle.jbo.domain.Number; import oracle.apps.fnd.framework.server.OAViewObjectImpl; import oracle.jbo.RowSetIterator; ...

public void deleteRecord(String Column1) { OAViewObject vo = (OAViewObject)getSearchVO1(); SearchVORowImpl row = null;

int fetchedRowCount = vo.getFetchedRowCount();

RowSetIterator deleteIter = vo.createRowSetIterator("deleteIter"); if (fetchedRowCount > 0) { deleteIter.setRangeStart(0); deleteIter.setRangeSize(fetchedRowCount); for (int i = 0; i < fetchedRowCount; i++) { row = (SearchVORowImpl)deleteIter.getRowAtRangeIndex(i); row.remove(); getTransaction().commit(); break; } }

Page 4: OAF Tips

deleteIter.closeRowSetIterator(); } // end deleteRecord

Note – Create Standard FND Messages DELETE_RECORD_WARN and DELETE_CONFIRM

Page 5: OAF Tips

6. Add DeleteSelection Handler Code to SearchCO.processFormRequest()

import com.sun.java.util.collections.HashMap; import oracle.apps.fnd.framework.webui.OADialogPage; import oracle.apps.fnd.framework.webui.OAWebBeanConstants; import oracle.apps.fnd.common.MessageToken; import oracle.apps.fnd.framework.OAException; import oracle.apps.fnd.framework.webui.OAWebBeanConstants; import oracle.apps.fnd.framework.OARow; import oracle.apps.fnd.framework.OAApplicationModule; ...

OAApplicationModule am = pageContext.getApplicationModule(webBean); OAViewObject vo =(OAViewObject)am.findViewObject("SearchVO1");

Page 6: OAF Tips

String rowRef = pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);

OARow row = (OARow)am.findRowByRef(rowRef);

if ("delete".equals(pageContext.getParameter(EVENT_PARAM))) { String Column1 = (String)row.getAttribute("Column1"); String Column2 = (String)row.getAttribute("Column2");

String Column3 = pageContext.getParameter("Column1"); String Column4 = pageContext.getParameter("Column2");

MessageToken[] tokens = { new MessageToken("COLUMN1", Column1), new MessageToken("COLUMN2", Column2)};

OAException mainMessage = new OAException("FND", "DELETE_RECORD_WARN", tokens);

OADialogPage dialogPage = new OADialogPage(OAException.WARNING, mainMessage, null, "", "");

String yes = pageContext.getMessage("AK", "FWK_TBX_T_YES", null); String no = pageContext.getMessage("AK", "FWK_TBX_T_NO", null);

dialogPage.setOkButtonItemName("DeleteYesButton");

dialogPage.setOkButtonToPost(true); dialogPage.setNoButtonToPost(true); dialogPage.setPostToCallingPage(true);

dialogPage.setOkButtonLabel(yes); dialogPage.setNoButtonLabel(no);

java.util.Hashtable formParams = new java.util.Hashtable(1); formParams.put("Column1", Column3); formParams.put("Column2", Column4); dialogPage.setFormParameters(formParams);

pageContext.redirectToDialogPage(dialogPage); }

7. Add Delete Confirmation Handler Code to SearchCO.processFormRequest()

Page 7: OAF Tips

import java.io.Serializable; import oracle.apps.fnd.framework.OAApplicationModule; ...

else if (pageContext.getParameter("DeleteYesButton") != null) { String Column1 = (String)row.getAttribute("Column1"); String Column2 = (String)row.getAttribute("Column2"); Serializable[] parameters = { Column1 };

OAApplicationModule am = pageContext.getApplicationModule(webBean);

am.invokeMethod("deleteRecord", parameters);

OAException message = new OAException("FND", "DELETE_CONFIRM", null, OAException.CONFIRMATION, null);

pageContext.putDialogMessage(message); }

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

Page 8: OAF Tips
Page 9: OAF Tips
Page 10: OAF Tips

Deploy OAF page

By PRajkumar on Apr 20, 2012

1. Copy all files from local machine to appropriate $JAVA_TOP directory 

2. Compile all java files (Controller Files) with command javac <file_name>.java

3, Call java importer to import all xml files

java oracle.jrad.tools.xml.importer.XMLImporter $JAVA_TOP/prajkumar/oracle/apps/fnd/webui/HelloWorldPG.xml -username apps -password apps -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST= <name of HOST>)(PORT=<port_number>))(CONNECT_DATA=(SID=<SID_NAME>)))" -rootdir $JAVA_TOP

4. Print Documents to check imported XML page content (Optional)

jdr_utils.printDocument('/prajkumar/oracle/apps/fnd/webui/HelloWorldPG',1000)

 

Page 11: OAF Tips

Example –

DECLARE

BEGIN

jdr_utils.printDocument('/prajkumar/oracle/apps/fnd/webui/HelloWorldPG',1000);

EXCEPTION

WHEN OTHERS THEN

DBMS_OUTPUT.PUT_LINE(SQLERRM);

END;

 

5. Create form function with property "SSWA jsp function" and webhtml "OA.jsp?page=/prajkumar/oracle/apps/fnd/webui/HelloWorldPG"

 

 

Page 12: OAF Tips

 

 

Page 13: OAF Tips

6. Add function to menu

 

7. Add menu to responsibility

Page 14: OAF Tips

Dependent LOV in OAF

By Manoj Madhusoodanan on May 07, 2012

This blog demonstrate the creation of dependent LOV in OAF.Here I will try to create Project and Task LOVs.Task LOV is dependent on Project LOV.Whenever user choose any Project,Task LOV will display only the task pertaining to selected project.

Prerequisites Steps ( OAF BC creation )

1) Create ProjectsVO as mentioned below in xxcust.oracle.apps.fnd.pa.lov.server

Page 15: OAF Tips

 2) Create TasksVO as mentioned below in xxcust.oracle.apps.fnd.pa.lov.server

3) Assign ProjectsVO and TaskVO to ProjectsAccountingLovAM

Project Lov Creation

 1) Create a page DependentLovDemoPG in xxcust.oracle.apps.fnd.pa.webui

2) Attach ProjectsAccountingLovAM to DependentLovDemoPG

3) Create a messageLovInput item ProjectName.It will create listOfValues and lovMappings region under it.

4) Right click listOfValues region and choose "Table using wizard" under "New"

5) Navigate through the shuttle.Choose AM as xxcust.oracle.apps.fnd.pa.lov.server.ProjectsAccountingLovAM

6) Choose "Available View Usage" as "ProjectsVO1"

7) Select all attributes from "Available View Attributes" to "Selected View Attributes"

8) Rename all Ids to _LOV.Change the style of ProjectId_LOV to formValue. This step is optional.

9) Select ProjectName_LOV item and make "Search Allowed" property to True

10) Create mapping for Project Name as follows

Page 16: OAF Tips

11) Create mapping for Project Id as follows.Project Id is a formValue of type NUMBER.

Task Lov Creation

1) Create a messageLovInput ProjectTask. Follow the steps shown below.

2) Rename all Ids to _LOV.Change the style of ProjectId_Task_LOV to formValue. This step is optional.

3) Set the properties of ProjectTaskName as follows

4) Set the properties of ProjectId_Task_LOV as follows

5) Set the properties of TaskName_LOV as follows

Summary of Properties

ID Property Name Value

ProjectName Select Search Criteria True

ProjectName_LOV Search Allowed True

ProjectNameMap Lov Region Item ProjectName_LOV

Return Item Project Name

Criteria Item Project Name

ProjectIdMap Lov Region Item ProjectId_LOV

Page 17: OAF Tips

Return Item ProjectId

ProjectTaskName Search Allowed True

Select Search Criteria True

ProjectId_Task_LOV Select Search Criteria True

TaskName_LOV Search Allowed True

TaskNameMap Lov Region Item TaskName_LOV

Return Item ProjectTaskName

Programmatic Query True

TasKProjectIdMap Lov Region Item ProjectId_Task_LOV

Criteria Item ProjectId

Required True

Blue color shows the important properties to make Task LOV dependable.

Output

Choose a project.After that choose a task.You can see only task related to project will list in the second LOV.

 If you choose another project the second LOV value will vanish.

OA Framework Personalization

By Manoj Madhusoodanan on May 09, 2012

In OAF the page definitions are stored in JDR tables normally called MDS repository.In the standard application sometimes customer wants some degree of changes in the display/functionality.OAF  has a mechanism called Personalization to achieve this.Personalizations are also stored in MDS but a layer above the page definition.So it is upgrade safe.

There are two types of Personalization s in OAF.

Page 18: OAF Tips

a) Admin Personalization : These are Personalizations done by implementers.They can be a technical or functional consultant or support staff.

 There are different level of Personalization.Following figure shows the various levels.Core OAF has least precedence and Responsibility has highest.

There are certain profiles options related to personalization.

1) Personalize Self-Service Defn : In order to do Personalization this profile has to set to "Yes" at appropriate level.

After setting this a "Personalize Page" link will appear in the global menu (top and bottom of page). User can click on this page and do Personalization.

 2) FND: personalization region Link Enabled : If you set this profile value to "Yes" and "Personalize Self-Service Defn" is also "Yes" the you can do Personalization at region level.

3) Disable Self-Service Personal : If you set to "Yes" at Site level all the OA Framework Extensions will be disabled.If you set to "Yes" at Application level then Personalization related to localization will be disabled.

 Personalization doesn't require single piece of coding.Through Personalization we can achieve following things.

Changing web bean properties like Tip,Label,Rendered,Read-only etc..

Changing order of fields

Adding new beans like button,drop down list,lov etc...

Embedding other regions

Here I will explain how to do Personalization with an example.We are going to personalize the standard Supplier creation page.The requirement matrix is as follows.

FieldsResponsibility

Payables Manager Payables, Vision Operations(USA)

Inactive Date Show Hide

Page 19: OAF Tips

Hold From Payment Show HideAlias Hide Hide

Navigation : Payables Manager>Suppliers>Entry

Identify Pages to be personalized

First thing we have to do is to identify the pages to be Personalized.For this identify the page(s) in which field resides.After that click on the "About this Page" link in the bottom of the page.

a) Inactive Date is spanned across two pages.So we have to personalize both.So the pages identified are as follows

   /oracle/apps/pos/supplier/webui/QuickUpdatePG   /oracle/apps/pos/supplier/webui/OrganizationPG

b) For Hold From Payment

   /oracle/apps/pos/supplier/webui/QuickUpdatePG    /oracle/apps/pos/supplier/webui/ByrInvPG

c) For Alias

/oracle/apps/pos/supplier/webui/QuickUpdatePG

Idenfify the level of Personalization

Second thing we have to do is to identify the level of Personalization.In our scenario we have to personalize in two levels.

Field Level of PersonalizationInactive Date ResponsibilityHold From Payment ResponsibilityAlias Site

Personalize the page

We can personalize a page in two ways.

Click on Personalize Page link in the global menu.

Page 20: OAF Tips

Go to Functional Administrator responsibility.Click on Personalization tab.Give Document Path.Click on Personalize Page

  Making Inactive Date as rendered false

Click on Personalize link of /oracle/apps/pos/supplier/webui/QuickUpdatePG

For Inactive Date we are going to hide this bean in Payables, Vision Operations (USA) reponsibility.So check the context in the personalize page.If the responsibility is different choose appropriate responsibility

Click on Expand All Locate the Inactive Date in the page.Press Personalize

Change the Rendered property at Responsibility level to false

Press Apply and in the next page.After that press "Return to Application"

Inactive Date personalization is completed for QuickUpdatePG.

Same way complete personalization of Inactive Date for /oracle/apps/pos/supplier/webui/OrganizationPG.

Making Hold From Payment as rendered false

Repeat the same steps as above for /oracle/apps/pos/supplier/webui/QuickUpdatePG and /oracle/apps/pos/supplier/webui/ByrInvPG.

Hiding Alias

Change the Rendered property to false in Site level.

QuickUpadtePG Before Personalization

Page 21: OAF Tips

QuickUpadtePG After Personalization

View through Payables, Vision Operations (USA)

b) User Level Personalization s: OAF allows end users to creates views on top of standard search regions.These type of views are called User Level Personalizations.

Migrating Personalizations

Following steps we need to perform to migrate Personalization from one instance to another.

Events in source instance.

Set profile option "FND: Personalization Document Root Path" appropriatly before exporting personalization.

Go to Functional Administrator.Click on Personalization tab. Under Import/Export click on Personalization Repository. Give Document Root Path as "/oracle/apps/pos/supplier/webui" and press Go.Page will

display all the Personalizations. Select all the listed Personalization s which you want to export and press Export to File System.

Go to the path in "FND: Personalization Document Root Path" and run " tar -cvf xxPersonalizations.tar ./* ".

Transfer the xxPersonalizations.tar to destination in Binary mode.

Events in destination instance.

Set profile option "FND: Personalization Document Root Path" appropriately before importing Personalizations.

Copy .tar file to middle tier directory pointed by "FND: Personalization Document Root Path". Run " tar -xvf xxPersonalizations.tar ". Go to Functional Administrator.Click on Personalization tab. Under Import/Export click on Exported Personalizations. Click on Import from File System.

Note: Instead of using Functional Administrator you can user java oracle.jrad.tools.xml.importer.XMLImporter also to upload Personalizations.

Page 22: OAF Tips

Eg: XMLImporter

Customizing Standard LOV using OAF Extension

By Manoj Madhusoodanan on May 17, 2012

In this blog I will explain how to customize a standard LOV using OAF extension.I will take a sample business scenario to explain this.In the standard supplier page I want to customize Parent Supplier Name LOV.

My requirement is to restrict the suppliers with HOLD_ALL_PAYMENTS_FLAG='Y'. So i have to add custom WHERE CLAUSE to existing View Object.

Here i am taking a sample supplier with Supplier Number as 12012130.This supplier has hold_all_payments_flag = 'Y'. So currently this supplier is part of LOV.So we want to restrict this supplier.

Page Link is : /oracle/apps/pos/supplier/webui/OrganizationPG

I will break this requirement into multiple pieces so that we can achieve easily.

a) Identify the Componentsb) Create the Solutionc) Apply the Changes and Test the Solution

I will explain the above steps in detail.

Identify the Components

 First of all we have to identify business components of LOV.For this click on Parent Supplier Name LOV.In the LOV page click on About This Page.After this click on Expand All.Here you can see all the business components attached to this LOV.

 Click on VendorsVO.

Page 23: OAF Tips

Now the View Object is identified as oracle.apps.pos.supplier.lov.server.VendorsVO.So we have to customize this VO and add custome where clause.

Download VendorsVO.xml from $JAVA_TOP to desktop (JDEV_USER_HOME/myprojects/oracle/apps/pos/supplier/lov/server).

Note: If there is any .class file transfer in binary mode.In this case there is no such.Transfer VendorsVO.xml in ASCII mode.

Create the Solution

In JDeveloper create custom VO xxcust.oracle.apps.pos.supplier.lov.server.XXCUSTVendorsVO.

The binding style should be same as orginal VO.

Compile the solution.

Create a substitution as shown below.

Now the solution is ready in your desktop and ready to migrate.

Apply the Changes and Test the Solution

1) Migrate xxcust.oracle.apps.pos.supplier.lov.server.XXCUSTVendorsVO to $JAVA_TOP\xxcust\oracle\apps\pos\supplier\lov\server.

2) Migrate the substitution.Go to jdevbin\oaext\bin under JDeveloper installation directory.Run the following command.

jpximport

The substitution will replace the oracle.apps.pos.supplier.lov.server.VendorsVO with xxcust.oracle.apps.pos.supplier.lov.server.XXCUSTVendorsVO whenever program refers VendorsVO.

3) Bounce the Apache server and check the LOV.

Page 24: OAF Tips

Note: You can verify the substitution is properly migrated or not by using following script.

jdr_utils.listdocuments

Output

Printing contents of /oracle/apps/pos/supplier/lov/server/ recursively/oracle/apps/pos/supplier/lov/server/customizations/site/0/VendorsVO

You can migration this substitution along with other personalization using Functional Administrator.

You can delete the substitution using following script.

jdr_utils.deleteDocument

Successfully deleted document /oracle/apps/pos/supplier/lov/server/customizations/site/0/VendorsVO.