Saturday, 24 March 2018

Part2 OAF Controller Extension In OAF :How to add OAF code in Controller Extension on Button Click Event

Part2 OAF Controller Extension In OAF :How to add OAF code in Controller Extension on Button Click Event

We need Controller Extension when we want to add custom Validations and to add extra monitoring in the Standard process or to Control the Standard Page behavior  then we do Controller Extensions to achieved this requirement. We can control the functionality of the Page through Controller codes and if we want to control the Standard OAF pages then we do OAF Controller Extensions.
 
This is the Second Part of OAF controller Extension. We have already created a OAF project in the J-Developer and now in the Post , we will start doing Controller Extension in this Project.
 
Here below is the First part of this Topic.
 

Step13:- Creation Controller Extension

Now right Click on the Project as below and click New.
 
 Part2 OAF Controller Extension In OAF :How to add OAF code in Controller Extension on Button Click Event

 
Step14:- Now Create Java Class as below
 
 Part2 OAF Controller Extension In OAF :How to add OAF code in Controller Extension on Button Click Event
 
 
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.
 
 Part2 OAF Controller Extension In OAF :How to add OAF code in Controller Extension on Button Click Event
 
Step16:- Select the same path under which your Standard Controller Placed in the Jdevhome folder MyProjects folder.
 
Like oracle/apps/ap/oie/webui
 
 
 Part2 OAF Controller Extension In OAF :How to add OAF code in Controller Extension on Button Click Event
 
 
Step17:- Select the 'TrackExpesneReportsCO' Standard Page Controller.
 Part2 OAF Controller Extension In OAF :How to add OAF code in Controller Extension on Button Click Event
 
 
Step18:-  Java Class values and Click Ok.
 
 
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.
 
 
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.
 
 
 
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.
 
 
 
 
 
 
Step24:- Now go to update Personalization under Header of your OAF page.
 
 Part2 OAF Controller Extension In OAF :How to add OAF code in Controller Extension on Button Click Event
 
 
Step25:-
Now put the location of your Extended Controller under CO field in the Personalize page.
Extended Controller Location :Oracle.apps.xxap.oie.webui.ExpenseReportCOEx
 
 Part2 OAF Controller Extension In OAF :How to add OAF code in Controller Extension on Button Click Event

 

4 comments:

Anonymous said...

Good Blog Thanks For Sharing this informative airtrl/
Oracle Fusion HCM Online Training
Oracle Fusion SCM Online Training
Oracle Fusion Financials Online Training
Big Data and Hadoop Training In Hyderabad

Anonymous said...

Brilliant blog I visit this blog it's incredibly awesome. Curiously, in this blog content formed doubtlessly and sensible. The substance of information is helpful.
Oracle Fusion Financials Online Training

Lakshmi Satya said...

Nice blog.
Oracle Fusion HCM Online Training

Anonymous said...

your blog is really informative and helpful for me. Thanks for sharing information
Oracle Fusion Financials Online Training
Oracle Fusion Technical Online Training

Post a Comment

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

Name

Email *

Message *