Saturday 31 March 2018

How to do VO Extension in OAF Through controller Extension: Add New column to Standard VO through Controller Extension

How to do VO Extension in OAF Through controller Extension: Add New column to Standard VO through Controller Extension

 
In this post , we will try to Do View Extension Through controller Extension. It means , we will add new column to the standard View Object , dynamically Through controller Extension. Some times its not  possible to do view extension in the Standard View Objects then we can use this approach and can do View Extension through controller Extension.
 
I will share you the Controller Code that how we can add new column to the standard view objects through controller Extension.
 
 
 
 public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    {   
super.processFormRequest(pageContext, webBean);
OAApplicationModue am= (OAApplicationModule)pageContext.getApplicationModule(webBean);
OAViewObject vo1=(OAViewObject)am.findViewObject("TrackExpenseReportsVO");
if (vo1 !=null)
{
vo1.addDynamicAttribute("XXTRACKINGNO");
}
vo1.reset();
vo1.next();
do
{
String RptHdrId   =Integer.parseInt(vo1.getCurrentRow().getAttribute(""ReportHeaderId").tostring());
Connection conn = paramOAPageContext.getApplicationModule(paramOAWebBean).getOADBTransaction().getJdbcConnection();
String Query = "SELECT ATTRIBUTE5 TRACKINGNO FROM ap_expense_report_headers_all WHERE report_header_id=TO_NUMBER(:1)";  
PreparedStatement stmt = conn.prepareStatement(Query);
stmt.setString(1,RptHdrId);
for(ResultSet resultset = stmt.executeQuery(); resultset.next();)
{
result = resultset.getString("status");;
  
}
 
String aString = result;
vo.getCurrentRow().setAttribute("XXTRACKINGNO",aString);
vo.next();
}
while (vo.hasNext());
vo.first();
 
/*XX_EXPENSE_TRACK_NO IS THE NEW ITEM CREATED THROUGH PERSONALIZATION IN THE VIEW OBJECT TrackExpenseReportsVO IN THE OAF PAGE */
 
How to do VO Extension in OAF Through controller Extension: Add New column to Standard VO through Controller Extension
 

OAMessageStyledTextBean mst=(OAMessageStyledTextBean)webBean.findChildRecursive("XX_EXPENSE_TRACK_NO");

mst.setViewUsageName("TrackExpenseReportsVO");
mst.setViewAttributeName("XXSalary");
 
}
 
 
 
How to do VO Extension in OAF Through controller Extension: Add New column to Standard VO through Controller Extension
 
 
 

Friday 30 March 2018

Part2 OAF VO Extension : How to add new Column in the Expense Report Summary Home Page

Part 2 OAF VO Extension : How to add new Column in the Expense Report Summary Home Page

 
In this post , we will do View Object VO extension in Oracle Application OAF web pages. first of all , we will discuss the need of the VO extension in OAF. When we have an requirement to display some more attributes or fields in the OAF page then we do VO extension to meet this requirement. We all know that , We see the data in the OAF page through View Objects(VO) and in a single page can have more then 1 View Objects(VO). First of all , we need to find out that , in which Standard View object , we need to add new Fields in OAF Page. Then we do view Extension , to add this new field in the View Object and then display this new Field in the OAF page through Personalizations.
This is the Second Part of OAF VO Extension. We have already created a OAF project in the J-Developer and now in the Post , we will start doing VO Extension in this Project.
 
Here below is the First part of this Topic.
 
 

Step13:- Creation VO Extension

 
Now right Click on the Project as below and click New.
 
Part2 OAF VO Extension : How to add new Column in the Expense Report Summary Home Page


 
Step14:- Now Create View Object as below :-
 
Part2 OAF VO Extension : How to add new Column in the Expense Report Summary Home Page

 
 
Step15:- Create Extended VO Name and select the Package.
Now select the Standard VO which you want to Extend Click on the Browse Button under Extends as below and Select the Standard View Object 'TrackExpesneReportsVO'  which we want to Extend in this VO Extension.
 
Part2 OAF VO Extension : How to add new Column in the Expense Report Summary Home Page
Select the same path under which your Standard Controller Placed in the Jdevhome folder MyProjects folder.
 
Step17:- Select the 'TrackExpesneReportsCO' Standard Page Controller.

 
 
Step18:- This is the Extended view Object Final Screen Click Next.
 
 
Step19:- This is The Query working for the Standard View Object. Copy the Query of the View Object in the Toad.
Part2 OAF VO Extension : How to add new Column in the Expense Report Summary Home Page
 
 
Step20:- Now Add the Custom column 'Attribute5' which you want to display in the OAF Page. Always add the New Column in the Last.
 
OAF VO Extension
 
 
Step21:-Paste the Changed Sql query in the VO Object and Click Next.
OAF VO Extension
 
Step22:-Select the required Check Box and click Finish.
OAF VO Extension
 
 
 
Step23:- This is the Extended VO created As Below.
 
OAF VO Extension
 
Step24:- Now We will do Substitution of this Custom view Object.
Right click on the Project and Click Project Properties.
 
Go to the Substitutions:-
 
OAF VO Extension
 
 
 
 
Step23:- Move the VO file in Java_Top and then Import this View Object with the Help of this Script.
java oracle.jrad.tools.xml.importer.XMLImporter $JAVA_TOP/oracle/apps/xxap/oie/server/ TrackExpenseReportsVOEx.xml -rootdir $JAVA_TOP -username apps -password apps -dbconnection " (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=server name)(PORT=100001))(CONNECT_DATA=(SERVICE_NAME=SID NAME)))"
 
 
Step23:- Now again go Back to the Web page in application where we want to do this View Object Extension. Now Click on the 'Personalize Link' Highlighted below.
 
 
 
 
 
Step24:- Now click on Create Item Icon as below to add new field in the View Object.
 
 
 
 
Step25:- Create Item with Style 'Message Styled Text'.
 
 
 
Step26:- Give the Item Properties as below.
 
 
Step27:- Give the name of the Extended View Object  in View Instance and the Name of your New View object Column in the View Attribute as below.
 
 
Step28:- Now we can see below Tracking No. field displaying in the OAF Expense Home Page.
 
 
Part2 OAF VO Extension : How to add new Column in the Expense Report Summary Home Page

OAF VO Extension : How to add new Column in the Expense Report Summary Home Page

OAF VO Extension : How to add new Column in the Expense Report Summary Home Page

In this post , we will do View Object VO extension in Oracle Application OAF web pages. first of all , we will discuss the need of the VO extension in OAF. When we have an requirement to display some more attributes or fields in the OAF page then we do VO extension to meet this requirement. We all know that , We see the data in the OAF page through View Objects(VO) and in a single page can have more then 1 View Objects(VO). First of all , we need to find out that , in which Standard View object , we need to add new Fields in OAF Page. Then we do view Extension , to add this new field in the View Object and then display this new Field in the OAF page through Personalizations.
 

VO Extension Steps:-

1.Indentify that Which VO we need to Extend
2. Download the VO from Oracle Java_Top Location to Your Local Desktop under My Projects folder of Your JDev setup.
3.Then We create New view Object(VO) which extends the Standard View Object.
4.Then We substitute the New Custom View Object with the Standard View Object.
5.Then we upload the New Custom View Object to Oracle Java_Top Location.
6.Then we Register the New View Object in the Oracle application Through XML Importer script.
8.After Import/Register , We add the new field in the OAF page through Personalization and then give reference in this Field for the New Custom View Object(VO).
 

OAF VO Extension Example: How to add new Column in the Expense Report Summary Home Page

 
Step1:- First Go to your OAF page in the application , in which you will do View Object Extension.
This is the Page in which we will do View Extension. Here I want to display the DFF attribute5 in this Track Submitted Expense Reports Status Window.
 
OAF VO Extension : How to add new Column in the Expense Report Summary Home Page

 
 
Step2:- To see the Properties of this Page and to know which View Object 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
 
OAF VO Extension : How to add new Column in the Expense Report Summary Home Page
 
 
 
Step4:-Click '+' icon for Business Components References Details.
 
OAF VO Extension
 
 
Step5:- This is the Location of the View Object under Java_Top under which you will do Extension.
 
OAF VO Extension
 
Step6:-
 
 Now you get to know that where is your Standard View Object 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 'TrackExpesneReportsVO' 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/server/' and then this copied file 'TrackExpesneReportsVO' 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.
 
OAF VO Extension
 
 
Step6:-This is the steps you have to implement before doing Start Extension in the JDeveloper.
 
Step7:- Now open the JDeveloper.
 
OAF VO Extension
 
 
 
 
Step8:- Now we will create OA Workspace and Project to do Controller Extensions.
 

OAF VO Extension
 
Step9:- Give the Name of OA Workspace. Click Ok.
OAF VO Extension
 
 
Step10:- Now Give the Name of the Project same like OA workspace.
Package Path:- Choose the same like Standard View Object but choose the application Top start with xx like this this change 'xxap'.
OAF VO Extension
 

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.
OAF VO Extension



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-vo-extension-how-to-add-new-column-in-the-expense-report-summary-home-page.html



OAF VO Extension : How to add new Column in the Expense Report Summary Home Page

Wednesday 28 March 2018

Assigning Values to the DFF attributes through SQL query in OAF Page through Controller Extension

Assigning Values to the DFF attributes through SQL query in OAF Page through Controller Extension

 
In this post , We will use SQL to fetch the data from some custom Table and then assign this fetched columns  in the DFF attributes. We will execute the SQL query based on the LOV selected value by the Business user in the OAF page. Here in this requirement , we will take help of Controller Extension to Capture the LOV selection event and then use the LOV selected value to fetch the sql query date and then assign this value to the DFF attributes for the OAF page. This is some thing we are giving solution out of the box from the standard application to capture the external information based on the Value selected by the user in  the LOV. We can then use this external information in the OAF pages through DFF fields.
 
Assigning Values to the DFF attributes through SQL query in OAF Page through Controller Extension
 

Assigning Values to the DFF attributes through SQL query in OAF Page through Controller Extension

 
Here below I am sharing you the Controller Extension for this above requirement.
 
There are the steps this Controller will do.
1.Capture the LOV selection event .
2.Then use the LOV selected value to fetch the sql query date.
3Then assign this value to the DFF attributes for the OAF page.
 
 
 
 public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    {
       super.processFormRequest(pageContext, webBean);
       
         OAApplicationModule am = pageContext.getApplicationModule(webBean);      
 
        String xxinvno=null;
        String Att1=null,Att2=null;
        String result ="";       
        if(pageContext.isLovEvent()) 
        { 
             String lovInputSourceId = pageContext.getLovInputSourceId(); 
             if("XXInvNo".equals(lovInputSourceId))
             { 
              
                  Hashtable lovValue = pageContext.getLovResultsFromSession(lovInputSourceId); 
                  if(lovValue !=null) 
                    { 
                      xxinvno =(String)lovResults.get("XXInvNo"); // "InvNo" is the Return Item specified in the lovMapping 
                          
                    }
                  if (xxinvno!=null) 
                  {
                      String sql = "select customer_name,phone_no from xx_third_pary_data where invocie_number= ="+ xxinvno;
                      try {
                          Connection conn = (Connection)am.getOADBTransaction().getJdbcConnection();
                          PreparedStatement sql1 = conn.prepareStatement(sql);
                          ResultSet rs = sql1.executeQuery();
                          while(rs.next())             
                            {
                             Attr1 = rs.getString(1).trim();
                             Attr2 = rs.getString(1).trim();                             
                             }
                            }
                        catch (Exception e)
                            {  e.printStackTrace();
                            }
                       OAViewObject viewobject1 = (OAViewObject)am.findViewObject("SuppliersHeaderVO");
                          if(viewobject1!=null)
                          {
                           pageContext.writeDiagnostics(this, "Successfully set the VO", 2);
                          }
                          OAMessageTextInputBean viotype = (OAMessageTextInputBean)webBean.findChildRecursive("Attribute1");
                           viotype.setValue(pageContext, Attr1);               
                          OAMessageTextInputBean Tktno = (OAMessageTextInputBean)webBean.findChildRecursive("Attribute2");
                           Tktno.setValue(pageContext, Attr2);     
                          }                   
                      }
              }         
          }


Assigning Values to the DFF attributes through SQL query in OAF Page through Controller Extension
 

How to Create Events in OAF Page Programmatically Through Controller Extension

How to Create Events in OAF Page Programmatically Through Controller Extension

We need events in OAF page to trigger our Custom Logic or Business Validations in the Application. If we are designing the OAF page through scratch then we can set events for each components or objects in the OAF page. There is no challenge in that. But if you are working with Standard OAF pages and where you cannot make any change in the Page layout or change the components properties of that OAF standard Page. Then in this case we take the  help of Controller Extensions to create events on any OAF components programmatically and achieve the business requirement. With the help of Controller Extensions we can easily create events on any objects of the OAF page like (button , Message Text Input) and then capture events to execute the Custom Code. Here we will create OAF events programmatically.
 
Here in this Example , I will took an example of one OAF page , where I have Email address user enterable field , and I want to put validation that , when user will enter email address in this field then system will validate that the user entered value should have character '@' in the Email address field.
To execute this code either this field should have predefined standard event  but we checked that there is not standard event for this email address user enterable field so in this case we will create OAF event for this email address user enterable field  programmatically through Controller Extensions.
 

How to Create OAF Events in OAF Page Programmatically

 
I have given the name of event is 'event1'
EmailAddress is the name of the OAF field on which we will create event ' event1'.
 
public void processRequest(OAPageContext paramOAPageContext, OAWebBean paramOAWebBean)

 {

 super.processRequest(paramOAPageContext, paramOAWebBean);
 
oracle.cabo.ui.action.fireaction eventaction = oracle.cabo.ui.action.fireaction();

eventaction.setEvent("event1"); 

eventaction.setUnvalidated(true);

EmailAddress.setPrimaryClientAction(eventaction); \*EmailAddress is the name of the Feild for which we are creating event */
}

public void processFormRequest(OAPageContext paramOAPageContext, OAWebBean paramOAWebBean)

    {
 
  super.processFormRequest(paramOAPageContext, paramOAWebBean);  

if("event1".equals(pageContext.getParameter(SOURCE_PARAM)))
 
{
 
IF(pageContext.getParameter("EmailAddress")!=null)
{
string email =pageContext.getParameter("EmailAddress");

if(email.indexOf('@')=-1)
{
throw new OA Expception("Invalid Email Entered",OAException.ERROR);
}
}
}
}
  }  
 


How to Create Events in OAF Page Programmatically

Tuesday 27 March 2018

How to Create Button in OAF Page Programmatically or Dynamically.

How to Create Button in OAF Page Programmatically or Dynamic

This is recommendable by Oracle to do no changes in the OAF page directly. To make nay direct changes in the OAF standard page is not advisable by the Oracle but some time , We need to do changes in the Page layout to match the business requirement. For these kind of scenarios , We can change the page layout through Controller Extensions and with the Help of OAF Personalizations. In this Post , I will show you , how we can create OAF Submit button in OAF Page through Controller Extension. I an sharing the controller code to create the Button in OAF Page Programmatically or Dynamically.
 
You have to Put this code under processRequest() method of your Controller.
 
How to Create Button in OAF Page Programmatically or Dynamically.
 

How to Create Button in OAF Page Programmatically or Dynamic

 
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
{

super.processRequest(pageContext, webBean);



OASubmitButtonBean NewSubmitButton= (OASubmitButtonBean)pageContext.getWebBeanFactory().createWebBean(pageContext,"BUTTON_SUBMIT");

 subBtn.setID("NewSubmitButton");
subBtn.setUINodeName("NewSubmitButton");
subBtn.setEvent("Submit");
subBtn.setText("Go ");  /*Go will be displaced on this Button' You can also write other Buttons too.
 RegionName.addIndexedChild(NewSubmitButton); /*This code will add the Go button in the Page Region. RegionName is the Actual name of your OAF Page Region'


}
 
 
How to Create Button in OAF Page Programmatically or Dynamically.

 

Saturday 24 March 2018

How to Integrate Java Decompiler with J Developer in OAF

How to Integrate Java Decompiler with J Developer in OAF

We often need in OAF to Decompile Class Files to Java Files. When we do Controller Extensions , We did not have Java files of Standard OAF page class files. In Java_Top we can only find the Class Files but to do Controller Extensions we need Java Files so for this we often need to Decompile class files to Java Files in OAF. Either we can Decompile Class files to Java Files outside JDeveloper but that is the Time consuming Job but to ease we can also integrate Java Decompiler with JDeveloper.

 

Step1:- Download the Java Decompiler as Below
 
 
 
Download the Windows version of Java Decompile
 
How to Integrate Java Decompiler with J Developer in OAF
 
 
 
Step2:- Go to JDeveloper ==> Tools ==>External Tool
 
How to Integrate Java Decompiler with J Developer in OAF
 
 
Step3:- Now Click New Button to Integrate Java Decompile with JDeveloper.
 
 
 
Step4:- Click Next
 
 
 
Step5:- Now Select the Java Decompile Executable from the Downloaded Folder where you download Java Decompiler Software.
 
How to Integrate Java Decompiler with J Developer in OAF
 
 
Step6:- click Next
 
How to Integrate Java Decompiler with J Developer in OAF
 
Step7:- Give the Name for Menu Item
Java Decompiler As below Click Next
 
 
 
Step8:- Click Next as below and select the Check Boxes as below :
 
 
Step9:- Click Finish.
How to Integrate Java Decompiler with J Developer in OAF
 
 
Now your Java Decompiler has been integrated with JDeveloper and you can use in the JDeveloper tool as below
 
Now Right Click on the Class file to which you want to Create Java File and Click on Java Decompile.
 
 
How to Integrate Java Decompiler with J Developer in OAF
 
 
 
How to Integrate Java Decompiler with J Developer in OAF

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

 

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

Name

Email *

Message *