OAF Tips
OAF Tips
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=VIS ION)))" -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',1 000); END;
Delete Records in OAF Page 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 ${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; } }
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");
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); }
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
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"
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.
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.
Summary of Properties
ID ProjectName ProjectName_LOV ProjectNameMap Property Name Select Search Criteria Search Allowed Lov Region Item Return Item Criteria Item ProjectIdMap Lov Region Item Value True True ProjectName_LOV Project Name Project Name ProjectId_LOV
Return Item ProjectTaskName Search Allowed Select Search Criteria ProjectId_Task_LOV TaskName_LOV TaskNameMap Select Search Criteria Search Allowed Lov Region Item Return Item Programmatic Query TasKProjectIdMap Lov Region Item Criteria Item Required
ProjectId True True True True TaskName_LOV ProjectTaskName True ProjectId_Task_LOV ProjectId 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.
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.
Fields Responsibility Payables Manager Payables, Vision Operations(USA)
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 Personalization Inactive Date Responsibility Hold From Payment Responsibility Alias Site
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
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.
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.
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.
Eg: XMLImporter
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 Components b) Create the Solution c) 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.
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.
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.