Join the OracleApps88 Telegram group @OracleApps88to get more information on Oracle EBS R12/Oracle Fusion applications.

If you are facing any issues while copying the Code/Script or any issues with Posts, Please send a mail to OracleApp88@Yahoo.com or message me at @apps88 or +91 905 957 4321 in telegram.

Friday, October 28, 2011

Controller Extension in R12 - OAF

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.


In this exercise I am going to extend CO of  ItemSearchPG of Lab solutions exercise shipped with Jdev Tutotrial.

The purpose of this exercise  is to modify the VO query of results table. I have changed the Item Number field Property "Selective Search" 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 Results name should not contain record for Item Number 3

If "About this Page" link is not available on page then set the Profile Option: FND :Diagnostics to "Yes" at User Level.
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.

So open Jdeveloper and create New OA Workspace and new Project under it as shown in below screen shots.

Click on File à New to open this window

Give the Workspace Name as OAExtenstions , check on Add a New Project and click Ok. 


This cause Project creation wizard to open. Name the project as OAExtensionsPrj and Default Package as xx.oracle.apps.fnd.framework.toolbox.labsolutions



Click on Next and move to Step 3 of 3 Give your DBC file name, User Name & Password for Apps , Responsibility Name and Application Short name. Then click next.



Now Right click on Your project and select New à General à Java Class click ok



Give the Name of your Extended Class give its  package path and in the extends property select base class.

Important : You need to copy the class file mentioned in Extends Property to MyClasses Folder if it is not there.

Name       :        XXItemSearchCO
Package   :        xx.oracle.apps.fnd.framework.toolbox.labsolutions.webui
Extends    :        oracle.apps.fnd.framework.toolbox.labsolutions.webui.ItemSearchCO



Write the logic in the extended controller file as needed
  1. package xx.oracle.apps.fnd.framework.toolbox.labsolutions.webui;  
  2.   
  3. import oracle.apps.fnd.framework.OAApplicationModule;  
  4. import oracle.apps.fnd.framework.toolbox.labsolutions.server.ItemSummaryVOImpl;  
  5. import oracle.apps.fnd.framework.toolbox.labsolutions.webui.ItemSearchCO;  
  6. import oracle.apps.fnd.framework.webui.OAPageContext;  
  7. import oracle.apps.fnd.framework.webui.beans.OAWebBean;  
  8. import oracle.apps.fnd.framework.webui.beans.layout.OAQueryBean;  
  9.   
  10.   
  11. public class XXItemSearchCO extends ItemSearchCO {  
  12.     public XXItemSearchCO() {  
  13.     }  
  14.      
  15.     public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)  
  16.      {  
  17.        super.processFormRequest(pageContext, webBean);  
  18.          OAApplicationModule am = pageContext.getApplicationModule(webBean);  
  19.          OAQueryBean queryBean = (OAQueryBean)webBean.findChildRecursive("QueryRN");  
  20.   
  21.          //Capturing Go Button ID  
  22.          String go = queryBean.getGoButtonName();  
  23.          
  24.          //If its Not NULL which mean user has pressed "Go" Button  
  25.          if(pageContext.getParameter(go)!=null)  
  26.          {  
  27.          // Setting whereClause at Runtime to restrict the query   
  28.          ItemSummaryVOImpl vo = (ItemSummaryVOImpl)am.findViewObject("ItemSummaryVO1");  
  29.          vo.setWhereClause(null);  
  30.          vo.setWhereClause("Item_id <>:1");  
  31.          vo.setWhereClauseParam(0,3);  
  32.          }  
  33.      }  
  34. }  


Now we need to attach this new controller with the page through personlisation. So click on Personalize page link on top right hand side of your page. If you are not able to see this link set Profile Option "Personalize Self-Service Defn"  to Yes.



Click on Complete View à Expand All and click on personalize icon next to pageLayoutRN



Now at site level give the path of extended controller as we are extending the controller at SITE LEVEL


Click on Apply Button and Return to Application.

Now you can check by click on Go Button that you are not getting Item id 3 rest are there.


No comments:

Post a Comment

If you are facing any issues while copying the Code/Script or any issues with Posts, Please send a mail to OracleApp88@Yahoo.com or message me at @apps88 or +91 905 957 4321 in telegram.
Best Blogger TipsGet Flower Effect