Showing posts with label OAF Extension Guide. Show all posts
Showing posts with label OAF Extension Guide. Show all posts

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

 

Friday, 23 March 2018

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

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

 
We will do today controller Extension in Oracle Application OAF pages. 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.
 
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.
 

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

 
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.
 
Controller Extension In OAF :How to add OAF code in Controller Extension on Button Click Event
 
 
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.
 
 
 
Step3:- Click on the Expand All option and in the Controller Section you can see the Controller Name.
 
Controller Extension In OAF :How to add OAF code in Controller Extension on Button Click Event
 
 
 

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.


Step by Step to do Controller Extension

This is the Location of the Controller under Java_Top under which you will do Extension.
OAF Extension Guide

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.

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

 
Step9:- Give the Name of OA Workspace. Click Ok.
 
 
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'.
 

Step11:- Then Finish this Project.
Controller Extension In OAF :How to add OAF code in Controller Extension on Button Click Event

Step12:- Now you can see your OAF Project has been completed. Now we will do Controller Extension under this Project.
 Due to the Length of this Topic , I will split this Topic two Posts. Please find the Second Part of this Post as below

Part2 url:- https://rpforacle.blogspot.in/2018/03/oaf-controller-extension-in-oaf-how-to-add-oaf-code-in-controller-extension-on-button-click-event.html


 

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

Name

Email *

Message *