Tuesday 31 March 2020

CO extension in oaf

CO extension in oaf

In this post , We will be discuss about CO extension in oaf. CO is one of the main object of any OAF page. It control the flow and logical portion of any OAF page. CO extension help to perform additional logic & conditions/Validations in the OAF page. IF we want to put some extra conditions or validation in oaf page , we can use the CO extension in oaf. We can customize the standard OAF page CO using CO extension in oaf page. Here below is the detail about CO extension in oaf.

CO extension Test Case :

In this example , I will do Controller Extension in the Expense Reports Home Page. Suppose your Business requirement is  that When ever user will withdraw his expense report then it will create history in the Custom table that how many times this particular Expense Report's  Withdraw and on which date. So lets start to do this.
 

Step By Step to perform CO extension in oaf

 
Step1:- First Go to your OAF page in the application , in which you will Controller Extension.
This is the Page in which we will do Controller Extension. you can see the Withdraw button in the Right side of the Page for Every Report.
 
CO extension in oaf
 
 
Step2:- To see the Properties of this Page and to know which controller is working behind this Page. for this we need to go to 'About this Page' in the Bottom of the Page.
 
CO extension in oaf
CO extension in oaf
 
 
Step3:- Click on the Expand All option and in the Controller Section you can see the Controller Name.
 
CO extension in oaf
 
 
 

Step4:- Now you know the Controller Name but you also need to get  the Location of the Controller in Oracle Application to so Controller Extension.


CO extension in oaf

This is the Location of the Controller under Java_Top under which you will do Extension.
CO extension in oaf

Step5:- Now you get to know that where is your Standard Controller is Placed in the Oracle application Under Java_Top.

Then you Need to go to Server Under Java_Top then Under Java_Top follow the same path 'oracle/apps/ap/oie/webui/' and copy the 'TrackExpesneReportsCO' from Server to your Local Desktop.

One Important Thing.

You need to create the same path in your JDev folder under' 'jdevhome'
Under JdevHome there is MyProjects' folder under this folder you have to Create same folder structure like oracle/apps/ap/oie/webui/' and then this copied file 'TrackExpesneReportsCO' in this Location.

The rule is you have to create same folder structure like the Folder Structure created for The Standard Controller in the Application server Java_Top.

 
CO extension in oaf
 
 
Step6:-This is the steps you have to implement before doing Start Extension in the JDeveloper.
 
Step7:- Now open the JDeveloper.
 
CO extension in oaf
 
 
 
 
Step8:- Now we will create OA Workspace and Project to do Controller Extensions.
 

CO extension in oaf
 
Step9:- Give the Name of OA Workspace. Click Ok.
 
CO extension in oaf
 
Step10:- Now Give the Name of the Project same like OA workspace.
Package Path:- Choose the same like Standard Controller but choose the application Top start with xx like this this change 'xxap'.
CO extension in oaf
 

Step11:- Then Finish this Project.
CO extension in oaf

Step12:- Now you can see your OAF Project has been completed. Now we will do Controller Extension under this Project.
CO extension in oaf

Step 13:- Creation Controller Extension
Now right Click on the Project as below and click New.
 
CO extension in oaf

 
Step14:- Now Create Java Class as below
 
CO extension in oaf
 
 
Step15:- Create Extended Controller Name and select the Package.
Now select the Standard Controller which you want to Extend Click on the Browse Button under Extends as below and Select the Standard Controller 'TrackExpesneReportsCO'  which we want to Extend in this Controller Extension.
 
CO extension in oaf
 
Step16:- Select the same path under which your Standard Controller Placed in the Jdevhome folder MyProjects folder.
 
Like oracle/apps/ap/oie/webui
 
 
CO extension in oaf
 
 
Step17:- Select the 'TrackExpesneReportsCO' Standard Page Controller.
CO extension in oaf
 
 
Step18:-  Java Class values and Click Ok.
CO extension in oaf
 
 
Step19:- Here below your Extended Java Class 'ExpenseReportCOEx' has been created Below. We will write the code to extend standard OAF page under this Java class.
CO extension in oaf
 
 
Step20:- OAF Code of this Extended Java Class as below:
 
 
package oracle.apps.xxap.oie.webui;
import java.sql.SQLException;


public class ExpenseReportCOEx extends TrackExpenseReportsCO {
    public ExpenseReportCOEx() {
    }
  
    public void processRequest(OAPageContext paramOAPageContext, OAWebBean paramOAWebBean)
       {
         super.processRequest(paramOAPageContext, paramOAWebBean);
       }
     
    public void processFormRequest(OAPageContext paramOAPageContext, OAWebBean paramOAWebBean)
       {
            Number ReportHeader;
               if ("WithdrawReport".equals(paramOAPageContext.getParameter("event")))
                      {
                          paramOAPageContext.writeDiagnostics(this, "Clicked on withdraw ", 1);
                      }
                    
    if (paramOAPageContext.getParameter("CommitWithdraw") != null)
           {      
           paramOAPageContext.writeDiagnostics(this, "Selected Yes to withdraw ", 1);
            OAApplicationModule am = (OAApplicationModule)paramOAPageContext.getApplicationModule(paramOAWebBean);
            OADBTransaction txn = am.getOADBTransaction();
            String str="BEGIN xx_insert_withdrawactions.insertrow(P_Header_id => :1);END;";
            OracleCallableStatement Callstmt=(OracleCallableStatement)txn.createCallableStatement(str,1);
            String Result = "";
    try{
                ReportHeader = new Number(paramOAPageContext.getDecryptedParameter("ReportHeaderId"));
             
          
                 String RptHdrId = ""+ReportHeader;
             Callstmt.setString(1,RptHdrId);
        
             Callstmt.execute();
      
                 paramOAPageContext.writeDiagnostics(this, "xx_insert_withdrawactions proc completed Successfully ", 2);       
             Callstmt.close();
             }  
    catch(SQLException sqle){
                 paramOAPageContext.writeDiagnostics(this, "Exception in calling sqlstatement  "+sqle, 2);        
             try { Callstmt.close(); } catch (Exception e) {
                 paramOAPageContext.writeDiagnostics(this, "Exception in calling sqlstatement  "+sqle, 2);       
             }
             }
            }
            super.processFormRequest(paramOAPageContext, paramOAWebBean);        
          
          
        }     
           
           
}
 
Step21:- Now right Click on this Java class to compile this code. Click Rebuild to compile this Class.
 
CO extension in oaf
 
 
Step22:- Now We have created the Java class file to extend the Standard Java Class.
After that We need to Put this Extended JavaClass'ExpenseReportCOEx' under Java_Top.
Server Path:- ava_top/Oracle/apps/xxap/oie/webui
 
Step23:- Now again go Back to the Web page in application where we want to do this Controller Extension. Now Click on the 'Personalize Page' Highlighted below.
 
 
 
CO extension in oaf
 
 
 
Step 24:- Now go to update Personalization under Header of your OAF page.
 
CO extension in oaf
 
 
Step 25:- Now put the location of your Extended Controller under CO field in the Personalize page.
Extended Controller Location :Oracle.apps.xxap.oie.webui.ExpenseReportCOEx

CO extension in oaf

0 comments:

Post a Comment

Contact us for any Collaboration, Project Support & On Job Support Work

Name

Email *

Message *