Controller Extension in OAF

By PRajkumar on Jul 15, 2012

Oracle does not recommend that customers extend controller objects associated with regions or webbeans in shipped E-Business Suite product pages. Controller class (oracle.apps.fnd.framework.webui.OAControllerImpl) methods should effectively be considered private, since their implementation is subject to change. Controller extensions are therefore not considered to be durable between upgrades. If it is absolutely essential to handle custom form submit events on a shipped product page, processFormRequest() is the only method that should be overriden in a controller class, although the risks outlined above still apply. Let us try to Extend Controller in OAF Page – Create one search page as explained in below link – https://blogs.oracle.com/prajkumar/entry/create_oaf_search_page In this exercise I am going to extend CO of SearchPG. First lets create CO for SearchPG. Right Click PageLayoutRN under SearchPG page > Set New Controller Package Name -- prajkumar.oracle.apps.fnd.searchdemo.webui Class Name -- SearchCO Now we will extend this newly created CO under this exercise. The purpose of this exercise is to modify the VO query of results table. I have changed theColumn1 and Column2 fields Property Selective Search Criteria as False. Now when we click on Go button all the records are displaying in the results table and our OBJECTIVE is to bind the VO query of results table in such a way that in result Column1 valueval5 and Column2 value val6 should not come as result on click Go button

Now for knowing which controller to extend we click on "About This Page" Link and select Expand All. Here we can see the Name of the controller that we need to extend .

prajkumar.1. Create a New Workspace and Project File > New > General > Workspace Configured for Oracle Applications File Name – PrajkumarCOExtensionDemo Automatically a new OA Project will also be created Project Name -.COExtensionDemo Default Package -.coextensiondemo .apps.fnd.oracle.

apps. Create a New Java Class Right Click on COExtensionDemo > New > General > Java Class Name -.fnd.server Extends -.oracle.oracle.coextensiondemo.prajkumar.2.apps.fnd.SearchCO Note -.webui.searchdemo.Give the Name of your Extended Class give its package path and in the extends property select base class .ExtendedCO Package -.prajkumar.

import oracle.framework.OAPageContext.oracle.apps.processFormRequest(pageContext.fnd.SearchCO. webBean).fnd.oracle.framework.findChildRecursive("QueryRN").fnd.webui. import oracle.framework. OAQueryBean queryBean = (OAQueryBean)webBean. //If its Not NULL which mean user has pressed "Go" Button if(pageContext.fnd.apps. //Capturing Go Button ID String go = queryBean.searchdemo.webui.getGoButtonName().apps.fnd.getParameter(go)!=null) .server. import prajkumar.oracle.fnd.beans. Write below logic in ExtendedCO Java Class package prajkumar. OAWebBean webBean) { super.apps. OAApplicationModule am = pageContext.OAApplicationModule.3.coextensiondemo.webui.searchdemo.OAQueryBean.getApplicationModule(webBean).apps.apps.apps. public class XXItemSearchCO extends ItemSearchCO { public XXItemSearchCO() { } public void processFormRequest(OAPageContext pageContext.OAWebBean.layout.webui.fnd.framework. import prajkumar.beans.SearchVOImpl. import oracle.webui. import oracle.

com/prajkumar/entry/how_to_enable_personalization_link Click on Complete View -> Expand All -> Click on personalize icon next to Page Layout . vo.oracle. vo.setWhereClause(null).setWhereClauseParam(1."val6"). Attach new controller to SearchPG through personalization Click on Personalize Page link on top right hand side of your page Note -.setWhereClauseParam(0.findViewObject("SearchVO1"). vo.{ // Setting whereClause at Runtime to restrict the query SearchVOImpl vo = (SearchVOImpl)am. vo. } } } 4."val5").If you are not able to see this link then go through below link – https://blogs.setWhereClause("Column1 <>:1 AND Column2 <>:2").

webui.fnd.ExtendedCO Click Apply -> Return to Application .coextensiondemo.apps.oracle.Now at site level give the path of extended controller as we are extending the controller atSITE LEVEL prajkumar.

Congratulation you have successfully finished. Run Your SearchPG page and Test Your Work Click Go Note – Record with Column1 value val5 and Column2 value val6 is not coming in result .5.