Sunday 9 November 2014

Deploy OAF pages in EBS R 12.2.3


    1)Move the class files to JAVA_TOP

    2) Run XML Import script   ffollow below steps to  Generate Jar file.


  1. Create a temporary custom.zip file which contains all the custom application's directories/files at the non-standard location. The commands are:
    1. cd $JAVA_TOP
    2. zip -r customprod.zip <directory list> where the <directory list> is the list of all the directory paths, relative to $JAVA_TOP, for custom application's java files at the non-standard location.
  2. Generate and sign the customprod.jar file. Command: adjava oracle.apps.ad.jri.adjmx -areas $JAVA_TOP/customprod.zip -outputFile $JAVA_TOP/customprod.jar -jar $CONTEXT_NAME 1 CUST jarsigner
  3. Follow the steps below to make the custom jar file available for WebLogic Server:
    1. Back up the existing <FND_TOP>/admin/template/ebsProductManifest_xml.tmp
    2. Modify <FND_TOP>/admin/template/ebsProductManifest_xml.tmp to add the entry below for customprod.jar (after customall.jar):
      <library>customprod.jar</library>
    3. Run AutoConfig.
    4. Bounce the middle-tier services.
    5. NOTE: These changes will be lost if ebsProductManifest_xml.tmp is patched in future; changes will need to be done again.
  4. In order to to synchronize the changes (during the next prepare phase) between both the file systems fs1 and fs2, follow the steps below. Note that the custom synchronization driver file, located at <APPL_TOP_NE>/ad/custom/adop_sync.drv, should be used in these steps. This file has the required documentation on how to put an entry in for a file that needs to be synchronized between the two file systems.
    1. If there are custom java class files under <JAVA_TOP>/oracle/<cust_prod>/* directory and if the files under this directory needs to be synchronized between fs1 and fs2 , then put the following entry in the custom synchronization driver file as below:
      cp -r %s_current_base%/EBSapps/comn/java/classes/oracle/<cust_prod> %s_other_base%/EBSapps/comn/java/classes/oracle
    2. To copy the custom jar file, add the following entry:
      cp %s_current_base%/EBSapps/comn/java/classes/customprod.jar %s_other_base%/EBSapps/comn/java/classes
    3. To synchronize the custom changes done to the template, add the entry below:
      cp %s_current_base%/EBSapps/appl/fnd/12.0.0/admin/template/ebsProductManifest_xml.tmp %s_other_base%/EBSapps/appl/fnd/12.0.0/admin/template
    4. After changes are synchonized, ensure Autoconfig is run for the latest template changes to take effect.

    Note:Refer DOC ID:1577661.1 from meta link for more Info

Bounce Command for EBS


Use below commands to Bounce the server for OAF from putty.

1) set Environment variable if any .

2) cd $ADMIN_SCRIPTS_HOME

11i:
adapcctl.sh stop;
adapcctl.sh start;

R12:
adoacorectl.sh stop
adapcctl.sh stop
adapcctl.sh start
adoacorestl.sh start

Below are the commands to bounce server in R12.2.3

adapcctl.sh stop
admanagedsrvctl.sh stop oacore_server1
Eneter Weblogic Password:********
admanagedsrvctl.sh start oacore_server1
Eneter Weblogic Password:********
adapcctl.sh start

OAF Page to Upload Files into Server

1. Create a New Workspace and Project
File > New > General > Workspace Configured for Oracle Applications
File Name – FileUploadDemo
 
Automatically a new OA Project will also be created
 
Project Name -- FileUploadDemo
Default Package -- xxupload.oracle.apps.fnd.fileuploaddemo
 
2. Create a New Application Module (AM)
Right Click on FileUploadDemo > New > ADF Business Components > Application Module
Name -- FileUploadAM
Package -- xxupload.oracle.apps.fnd.fileuploaddemo.server
Check Application Module Class: FileUploadAMImpl Generate JavaFile(s)
 
3. Create a New Page
Right click on FileUploadDemo > New > Web Tier > OA Components > Page
Name -- FileUploadPG
Package -- xxupload.oracle.apps.fnd.fileuploaddemo.webui

4. Create a New Item messageFileUpload Bean under MainRN 
  
Right click on MainRN > New > messageFileUpload
Set Following Properties for New Item -- 
ID:MessageFileUpload
Item type:MessageFileUpload 



Write Following Code in FileUploadCO processFormRequest
import oracle.cabo.ui.data.DataObject;
import java.io.FileOutputStream;
import java.io.InputStream;
import oracle.jbo.domain.BlobDomain;
import java.io.File;
import oracle.apps.fnd.framework.OAException;

public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{ super.processFormRequest(pageContext, webBean);  

 if(pageContext.getParameter("Submit")!=null)
 {
  upLoadFile(pageContext,webBean);    
 }
}





Write Following Code in FileUploadCO processFormRequest
 
import oracle.cabo.ui.data.DataObject;
import java.io.FileOutputStream;
import java.io.InputStream;
import oracle.jbo.domain.BlobDomain;
import java.io.File;
import oracle.apps.fnd.framework.OAException;

public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{ super.processFormRequest(pageContext, webBean);  

 if(pageContext.getParameter("Submit")!=null)
 {
  upLoadFile(pageContext,webBean);    
 }
}


public void upLoadFile(OAPageContext pageContext,OAWebBean webBean)
{ String filePath = "/u01/app/apnac03r12/";
 System.out.println("Default File Path---->"+filePath);

 String fileUrl = null;
 try
 {
  DataObject fileUploadData =  pageContext.getNamedDataObject("MessageFileUpload");

//FileUploading is my MessageFileUpload Bean Id
  if(fileUploadData!=null)
  {
   String uFileName = (String)fileUploadData.selectValue(null, "UPLOAD_FILE_NAME");  
   String contentType = (String) fileUploadData.selectValue(null, "UPLOAD_FILE_MIME_TYPE");  
   System.out.println("User File Name---->"+uFileName);

   FileOutputStream output = null;
   InputStream input = null;

   BlobDomain uploadedByteStream = (BlobDomain)fileUploadData.selectValue(null, uFileName);
   System.out.println("uploadedByteStream---->"+uploadedByteStream);
                          
   File file = new File("/u01/app/apnac03r12/PRajkumar", uFileName);  
   System.out.println("File output---->"+file);

   output = new FileOutputStream(file);
   System.out.println("output----->"+output);
   input = uploadedByteStream.getInputStream();

   System.out.println("input---->"+input);
   byte abyte0[] = new byte[0x19000];
   int i;
    
   while((i = input.read(abyte0)) > 0)
   output.write(abyte0, 0, i);

   output.close();
   input.close();
  }
 }
 catch(Exception ex)
 {
  throw new OAException(ex.getMessage(), OAException.ERROR);
 }    
}
 


 

Friday 31 October 2014

useful scripts in OAF


JPX import in Unix Environment

java oracle.jrad.tools.xml.importer.JPXImporter $JAVA_TOP/TestProject.jpx -username $APPS_NAME -password $APPS_PASSWORD -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=<HOSTNAME>)(Port=<port number>)) (CONNECT_DATA=(SID=<SID>)))"

XML Import in Unix Environment

java oracle.jrad.tools.xml.importer.XMLImporter  $JAVA_TOP/xxmhp/oracle/apps/per/loan/webui/TestPG.xml   --rootdir  $JAVA_TOP username <user name> -password <password> -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=<hostname>)(PORT=<port number>))(CONNECT_DATA=(SID=<SID>)))" 


XML Import in Windows Environment

import d:\Jdevloper\jdevhome\jdev\myprojects\xx\oracle\apps\per\webui\EmployeePG.xml -rootdir d:\jdevhome\jdev\myprojects -username apps -password apps -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=<hostname>)(PORT=<port number>))(CONNECT_DATA=(SID=<SID>))))

JPX import in Windows Environment

jpximport d:\Employee.jpx -userId 1 -username apps -password apps -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=<hostname>)(PORT=<port number>))(CONNECT_DATA=(SID=<SID>))))"


JSP Compilation in Unix Environment

Move your JSP into OA_HTML Directory and run below commands to Compile JSP. Compiled JSP will create respected JSP Class file in $COMMON_TOP/_pages

11i Environment

$JTF_TOP/admin/scripts/ojspCompile.pl --compile -s 'abcd.jsp' --flush

R12 Environment

$FND_TOP/patch/115/bin/ojspCompile.pl --compile -s 'abcd.jsp' --flush


Friday 11 July 2014

Shuttle Region in OAF

Shuttle region allows users to move items between two lists as well as reorder the items in the list. When you implement a Shuttle region, you define two lists:


A Leading list (Available List) - from which user can select items from a given list of items
A Trailing list (Selected List) - user will select item from Leading list and move those to this trailing list.

Also we can implement a Shuttle region with just one list, to achieve only Reorder functionality, in that case only a Leading list is required.

We can also add buttons/icons in the footer below each of the Shuttle lists. By Simply defining Leading footer child or Trailing footer child in region creates a flowLayout region by default, to which we can add a button or image.

Here, I have created a simple page to implement shuttle region. User will select employee name from 'Available List' and move them to 'selected List'. A button is also added at footer of trailing list. Clicking on this button will show all the employees selected in a message.

1) Create a new OA page:
=========================
Right click on project (xxcus) --> New --> Web Tier --> OA Components --> select 'Page' item. Click OK. (This will open a popup window)
We are creating a page for implementing shuttle region, so specify the details of page as below:
          Name: XxShuttleDemoPG
          Package: xxcus.oracle.apps.fnd.shuttledemo.webui

2) Create a new view objects (VO):
=========================
Right click --> New View Object (This will open a wizard having 7 steps).

Step 1
         Package: xxcus.oracle.apps.fnd.shuttledemo.server
         Name: XxEmpShuttleVO
         Choose the radio button 'Read-only Access' (as there is no DML operation). Click Next.

Step 2
         Enter the below query in 'Query Statement':
               select ename from employee

Keep defaults for step3, 4, 5, 6 & 7 and click Finish. Save All.   

3) Create a new Application Module (AM):
=========================

Step 1
         Package: xxcus.oracle.apps.fnd.shuttledemo.server
         Name: XxShuttleDemoAM. Click Next.

Step 2
    Here we will add an instance of the VO created in (2). Select XxEmpShuttleVO from 'Available View Objects' and shuttle it to 'Data Model' using ">" button.

Keep defaults for all other steps (3, 4). Click Finish.

4) Create a new Controller (CO):
=========================
Right click on pageLayout region and create a new controller
            Name: XxShuttleDemoCO
            package: xxcus.oracle.apps.fnd.shuttledemo.webui


5) Creating the Page Layout & Setting its Properties :-
==========================
The page will appear as below:



1) Create a new region under pageLayout of type shuttle. This will automatically create a region for leading list.
2) Add Trailing list: right click shuttle region --> new --> Trailing.
3) Add trailing footer to display button: Again right click on shuttle region --> new --> trailingFooter. This will create a flowLayout region under trailingFooter.
4) Add 'Display Items' button: Create an item of type submitButton under the flowLayout region.

Now change the properties for each field from property inspector as shown below:


pageLayout:
            ID: pageLayoutRN
            AM Definition: xxcus.oracle.apps.fnd.shuttledemo.server.XxShuttleDemoAM
            Window Title: Shuttle Demo Page
            Title: Shuttle Demo

shuttle:
           ID: shuttleRN
           Available Header: Available Employees
           Selected Header: Selected Employees


leadingList:
           Picklist View Definition: xxcus.oracle.apps.fnd.shuttledemo.server.XxEmpShuttleVO
           Picklist View Instance: XxEmpShuttleVO1
           Picklist Display Attribute: Ename
           Picklist Value Attribute: Ename

list2:
           Picklist Display Attribute: Ename
           Picklist Value Attribute: Ename

submitButton:
           ID: displayBtn
           Prompt: Display Items

The declarative page structure in jDev will be similar to as shown below:


We will catch the button event (displayBtn) in PFR method of controller and display a message showing all the employees present in selected list. If there is no item in selected list, throw an error message. Below is code for the same:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
public void processFormRequest(OAPageContext pageContext,
                               OAWebBean webBean) {
    super.processFormRequest(pageContext, webBean);
     
    String message = "";
     
    if (pageContext.getParameter("displayBtn") != null) {
        OADefaultShuttleBean shuttle =
            (OADefaultShuttleBean)webBean.findChildRecursive("shuttleRN");
        String[] items =
            shuttle.getTrailingListOptionValues(pageContext, shuttle);
     
    if (items != null) {
            for (int i = 0; i < items.length - 1; i++) {
                message = items[i] + " , " + message;
            }
             
            message = message + items[items.length - 1];           
            throw new OAException("Items in trailing list are: " +
                                  message, OAException.INFORMATION);
        } else {
       throw new OAException("Please shuttle at least one item from available list.",
                                  OAException.ERROR);
        }
    }
}

Below is how the error message will appear: