Anil's Blog is Best Viewed on GOOGLE CHROME

Friday, September 24, 2010

Popup in OAF - R12.1.2 Part II

If you have not gone through Popup first exercise then please go through to get brief intro about Popups.

Popup in OAF Part1

We can also UPDATE  through Popup region without navigation to update page.


The  region  popups when user click on update inline image.

We will be creating a new External Region EmpPopupRN for this popup. No need to give AM definition for this region. Add a submit button & beans in this region for which you want to update Set the VO attribute and VO name same as the VO of results table i.e. EmployeeSummaryVO.





Now in your Results table of Search Page Add a flowLayoutRN and under it create an item of style image and a region of style popup.



Now click on your popup region EmployeePopup and set its properties

Region             Path of above External Region EmpPopupRN
Title                 Update Employee
Height              190
Width               380





Now click on image Set the following properties.


PopupId                                  EmployeePopup
Popup Render Event             On Click
Popup enabled                        True

Now in our page as we will be having a save button so we need to handle this button and post the data when user clicks on it. So we will be writing our code in PFR of EmployeeResultsCO


if (pageContext.getParameter("Save") != null )
 {
 OAApplicationModule am = pageContext.getApplicationModule(webBean);
 am.invokeMethod("apply");
 }

//and this calls out Apply method in AM

public void apply()
{
 getTransaction().commit();

}

Now you can run your page and see that now you can update the fields without navigating to other page.

Compare VO row with Database row - OAF

Comparing VO row with DB Row to ensure that user has changed some VO Attribute value or not when user is submitting the page

Thanks
--Anil

Controller Extension in R12 - OAF

Controller/CO Extension - Jdev10G


Thanks Ajay for giving such a nice article 

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
package xx.oracle.apps.fnd.framework.toolbox.labsolutions.webui;

import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.toolbox.labsolutions.server.ItemSummaryVOImpl;
import oracle.apps.fnd.framework.toolbox.labsolutions.webui.ItemSearchCO;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.apps.fnd.framework.webui.beans.layout.OAQueryBean;


public class XXItemSearchCO extends ItemSearchCO {
    public XXItemSearchCO() {
    }
   
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
     {
       super.processFormRequest(pageContext, webBean);
         OAApplicationModule am = pageContext.getApplicationModule(webBean);
         OAQueryBean queryBean = (OAQueryBean)webBean.findChildRecursive("QueryRN");

         //Capturing Go Button ID
         String go = queryBean.getGoButtonName();
       
         //If its Not NULL which mean user has pressed "Go" Button
         if(pageContext.getParameter(go)!=null)
         {
         // Setting whereClause at Runtime to restrict the query 
         ItemSummaryVOImpl vo = (ItemSummaryVOImpl)am.findViewObject("ItemSummaryVO1");
         vo.setWhereClause(null);
         vo.setWhereClause("Item_id <>:1");
         vo.setWhereClauseParam(0,3);
         }
     }
}


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.




That all ... :)