Anil's Blog is Best Viewed on GOOGLE CHROME

Thursday, April 30, 2009

RADIO GROUP EVENT

import oracle.apps.fnd.framework.webui.beans.message.OAMessageRadioButtonBean;
import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageRadioGroupBean;

//If you want your radio buttons to behave as a group, you must programmatically assign them all the same name by calling setName() for each radio button.

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


OAMessageRadioButtonBean appleButton =
(OAMessageRadioButtonBean)webBean.findChildRecursive("GroupButtonOne"); //First Radio Button
appleButton.setName("fruitRadioGroup");
appleButton.setValue("APPLES");

OAMessageRadioButtonBean orangeButton =
(OAMessageRadioButtonBean)webBean.findChildRecursive("GroupButtonTwo"); //Second Radio Button
orangeButton.setName("fruitRadioGroup");
orangeButton.setValue("ORANGES");
}


public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processFormRequest(pageContext, webBean);
OAApplicationModule am = pageContext.getApplicationModule(webBean);

//You can then obtain the selected radio button in your processFormRequest() as follows:

String radioGroupValue = pageContext.getParameter("fruitRadioGroup");
}


A know issue comes while implementing Radio Group refer to below link for more details:
Value that you need to set declaratively

Wednesday, April 29, 2009

TO Find @ in column

if (pageContext.getParameter("item1") != null)
{
OAViewObject oaviewobject1 = (OAViewObject)am.findViewObject("NewEmployeeVO1");

if (oaviewobject1 != null)
{
System.out.println("Inside");
oaviewobject1.reset(); //New line added
oaviewobject1.next(); //new line added
OARow row = (OARow)oaviewobject1.getCurrentRow();

String email = row.getAttribute("Attribute1")+"";
System.out.println("Attribute1"+ email);
if( email.indexOf("@")<0)
throw new OAException("Invalid Email Entered", OAException.ERROR) ;
}
}

Thursday, April 16, 2009

Setting WhereClause in VOImpl

public class XXOAViewObjectImpl
{
/**This is the default constructor (do not remove)
*/
public XXVOImpl() {
}
public void initMajorList(String categoryID){
setWhereClauseParams(null); // Always reset
setWhereClauseParam(0, orgId);
setWhereClauseParam(1, categoryID);
setWhereClauseParam(2, compPlanId);
executeQuery();

}



}

The JDBC Tutorial: Chapter 3 - Advanced Tutorial

http://java.sun.com/developer/Books/JDBCTutorial/

Important Profile Options in OAF

FND_Diagnostics


Setting the FND : Diagnostics (FND_DIAGNOSTICS) profile option to "Yes" will enable the diagnostics global button to be rendered on the screen. Pressing this button brings the user to an interface where the user can choose what type of logged messages to display.


Personalization Levels


Personalizations can be enabled at the function, site, operating unit or responsibility level. Personalizations at lower levels override personalizations at higher levels. Values inherit the definition from the level immediately above unless changed.


FND: Personalization Region Link Enabled :
Valid values:  Yes - renders the "Personalize  Region" links above each  region in a page. Each link  takes you first to the Choose Personalization Context page, then to the Page Hierarchy Personalization page with focus on the region node from which  you selected the "Personalize  Region" link.


Personalize Self-Service Defn – Set this profile to Yes to allow personalizations.


Disable Self-Service Personalization - Yes will disable all personalizations at any level.


FND: Personalization Document Root Path (new in 11.5.10) - Set this profile option to a tmp directory with open (777)  permissions for migrating personalizations between instances.




How to See Log on Page


Enable profile Option FND_Diagnostics to "Yes" at User OR Site Level.


In Controller write this code:-
pageContext.writeDiagnostics(this, "Checking profile options", 1);


In Application Module write this code
getOADBTransaction().writeDiagnostics(this, "Checking Profile Option", 1);


Now to see log on screen Click on “Diagnostics” on Page [Top right on page]



Then Choose Show Log on Screen from the picklist and choose log level as Statement Level and Click on Go




Onion Architecture of OA Framework

OA Framework can be extracted into a series of concentric layers, like an onion.

Each layer only “knows”about the layers below it.The core layer represents the database and the surface layer represents the application pages. In between is a number of business logic and user interface layers. This layering allows for generic code and components to be implemented at the inner layers to maximize their reuse across the outer layers.

For example, attribute validation is implemented at the Entity Object (a BC4J object-oriented representation of a database table in the middle tier) level.





How to capute current row in Table Region

public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)

{

super.processFormRequest(pageContext, webBean); OAApplicationModule am =
(OAApplicationModule)pageContext.getApplicationModule(webBean);

String event = pageContext.getParameter("event");
if ("").equals(event))
{
// Get the identifier of the PPR event source row
String rowReference =
pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
Serializable[] parameters = { rowReference };
// Pass the rowReference to a "handler" method in the application module.

am.invokeMethod("", parameters);
}
}
 
In your application module's "handler" method, add the following code to access the source row:


OARow row = (OARow)findRowByRef(rowReference);

if (row != null)

{
...
}

How to compare two dates

import oracle.jbo.domain.Date;

Date scoStartDate = null;
Date scoEndDate = null;
 
scoStartDate = (Date)rowi.getScoRoleStartDate();  // Capturing dates from RowImpl
scoEndDate = (Date)rowi.getScoRoleEndDate();  // Capturing dates from RowImpl
 
java.sql.Date javaSqlDate = scoStartDate.dateValue();

if (scoEndDate.dateValue().before(javaSqlDate))
{
           //throw Exception
}

Prepared Statement - Controller

Controller - ProcessFormRequest Code

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

try

{


Connection conn = pageContext.getApplicationModule(webBean).getOADBTransaction().getJdbcConnection();

String Query = "SELECT count(*) count from XX_PA_SCO_V where project_id=:1 and CI_ID is not null";

PreparedStatement stmt = conn.prepareStatement(Query);
stmt.setString(1, project_id);
for(ResultSet resultset = stmt.executeQuery(); resultset.next();)
{
pageContext.writeDiagnostics(this, "Query Executed", 1);
result = resultset.getInt("count");;
pageContext.writeDiagnostics(this, "Query Executed"+ result, 1);
}
}

catch(Exception exception)

{ 
throw new OAException("Error in Staffing Query"+exception, OAException.ERROR);
}

if(result >0)
{
throw new OAException("One or more Scope Change Order is existing on this project", OAException.INFORMATION);
}


Callable Statement in Controller

import java.sql.CallableStatement;

import java.sql.Types;
import oracle.apps.fnd.framework.OAApplicationModule;

import oracle.apps.fnd.framework.OAException; 
import oracle.apps.fnd.framework.server.OADBTransaction; 
  
try 

{
Connection conn = (Connection)oapagecontext.getApplicationModule(oawebbean).getOADBTransaction().getJdbcConnection();

CallableStatement cs = conn.prepareCall("{call XX_UPDATE_SCO_DETAILS_PKG.SCO_ADD_ON_WORK(?,?,?,?,?,?,?)}"); 

cs.setString(1, Proj_ID);
cs.setString(2, SCOID);
cs.setString(3, Assign_ID);
cs.setString(4, "ADD_NEW_RESOURCES");
cs.setString(5, strStartDate);
cs.setString(6, strEndDate);
cs.registerOutParameter(7, Types.VARCHAR);
cs.execute();
error_mess = cs.getString(7);
if(!StringUtils.isNullOrEmpty(error_mess))
{
throw new OAException("Error in saving data in custom table OR Updating LOE: "+error_mess);
}
conn.commit();
cs.close();
}
catch (SQLException sqle)
{
throw OAException.wrapperException(sqle);
}
Debug.log(oapagecontext, this, "Callabe Statement Executed", 3);




Friday, April 10, 2009

How to return array from Application Module

Controller Code

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import oracle.apps.fnd.framework.OAException; 
  

Serializable paras[] = {employee_id};
Object result[] = new Object[10]; // declaring result of Array Type
result = (Object[])am.invokeMethod("getparameters", paras); // Calling AM Method

String userid = (String)result[0]; // Capturing value from Array
String userName = (String)result[1]; // Capturing value from Array


Application Module Code

public Object[] getparameters(String employeeid)
{
ResultSet resultset = null;
int employee_id = Integer.parseInt(employeeid);

Object result[] = new Object[10];
OADBTransaction oadbtransaction = getOADBTransaction();
Debug.write(oadbtransaction, this, "Employee id is " + employee_id, 1);

try
{
Connection conn = getOADBTransaction().getJdbcConnection();
String query = "sselect user_id, user_name from fnd_user where employee_id=:1";

PreparedStatement stmt = conn.prepareStatement(query);
stmt.setInt(1, employee_id);

for(resultset = stmt.executeQuery(); resultset.next(); 
{

result[0] = resultset.getString("user_id");
Debug.write(oadbtransaction, this, "Project Number is " + result[0], 1);

result[1] = resultset.getString("user_name");
Debug.write(oadbtransaction, this, "Project ClassCode is " + result[1], 1);

}
}

catch(Exception e)

{
Debug.write(oadbtransaction, this, "Exception " + e.getMessage(), 1);
}
return result; // Returning result array to Controller
}

Creating VO at RunTime in Controller OR Dynamically created VO

ViewObject viewobject = oapagecontext.getApplicationModule(oawebbean).findViewObject("ObtainProjectId");


if(viewobject == null)
{
String s14 = "SELECT project_id FROM PA_PROJECTS_ALL WHERE segment1 =:1";
viewobject = oaapplicationmodule.createViewObjectFromQueryStmt("ObtainProjectId", s14);
}

viewobject.setWhereClauseParam(0, s5);
viewobject.executeQuery();
int i = viewobject.getRowCount();
if(i != 1)

{
Debug.log(oapagecontext, this, "Error : Project Number is Invalid or not unique", 3);
OAException oaexception4 = null;
oaexception4 = new OAException("PA", "PA_PROJECT_NUMBER_INVALID");
oaexception4.setApplicationModule(oaapplicationmodule);
throw oaexception4;
}

oracle.jbo.Row row = viewobject.last();

if(row != null)
{
Object obj2 = row.getAttribute(0);
if(obj2 != null)
{
s3 = obj2.toString();

if(s3 != null)
{
oapagecontext.putTransactionValue("paProjectId", s3); // Capturing projectid in Session

if(oaapplicationmodule.findViewObject("AddNewAssignmentsVO") != null)

{
oaapplicationmodule.findViewObject("AddNewAssignmentVO").first().setAttribute("ProjectId", s3);
}
}
}
}

Wednesday, April 8, 2009

Getting & Setting Value

Capturing the value from VO and setting Explictiy in EO



import oracle.apps.fnd.framework.OAViewObject;
import oracle.apps.fnd.framework.OARow;


public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
   super.processFormRequest(pageContext, webBean);
    OAApplicationModule am = pageContext.getApplicationModule(webBean);


OAViewObject oaviewobject1 =(OAViewObject)am.findViewObject("NewEmployeeVO1");
if (oaviewobject1 != null)
{
System.out.println("Inside");
oaviewobject1.reset(); //New line added
oaviewobject1.next(); //new line added
OARow row = (OARow)oaviewobject1.getCurrentRow();
String fullName = (String)row.getAttribute("FullName");

OAViewObject vo1 = (OAViewObject)am.findViewObject("EmployeeEOVO1");
vo1.reset();
if (vo1 != null)
{
do
{
if(!vo1.hasNext())
break;
vo1.next();
EmployeeEOVORowImpl lcerl = (EmployeeEOVORowImpl)vo1.getCurrentRow();
lcerl.setFullName(fullName);

}while(true);
}
}

Convert dateToString | stringToDate

Controller Code:-

Date date = (Date)oaapplicationmodule.findViewObject("AddNewAssignmentVO").first().getAttribute("StartDate");
Date edate = (Date)oaapplicationmodule.findViewObject("AddNewAssignmentVO").first().getAttribute("EndDate");


if (date != null && edate != null)
                       {
                        String Xs11 = oapagecontext.getOANLSServices().dateToString(date);
                        String Xs12 = oapagecontext.getOANLSServices().dateToString(edate);
}

In the same way we can convert String to Date
oapagecontext.getOANLSServices().stringToDate("xxxx");

Creating View Object and MessageChoiceBean Programatically

Controller Code
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processRequest(pageContext, webBean);
String sMode = "test";
OAApplicationModule am = pageContext.getApplicationModule(webBean);
OAViewObject oaviewobject = (OAViewObject)am.findViewObject("xxScoResourceVO1");
if(oaviewobject == null)
{
oaviewobject = (OAViewObject)am.createViewObject("xxScoResourceVO1","xx.oracle.apps.pa.poplist.server.xxScoResourceVO");
}
      
oaviewobject.setWhereClause("DESCRIPTION IS NULL OR DESCRIPTION = '" + sMode + "'"); //Setting where clause Dynamically of Poplist VO

oaviewobject.executeQuery();
OAMessageChoiceBean oamessagechoicebean = (OAMessageChoiceBean)createWebBean(pageContext, "MESSAGE_POPLIST");
oamessagechoicebean.setPrompt("Back");
oamessagechoicebean.setListViewObject(pageContext, oaviewobject);
oamessagechoicebean.setListDisplayAttribute("Meaning");
oamessagechoicebean.setListValueAttribute("LookupCode");
  
oamessagechoicebean.setName("xxAddAsgmtApplyAction");
oamessagechoicebean.setAllowBlankValue(false);
oamessagechoicebean.setDefaultValue("RETURN_BACK"); //Setting Default Value
webBean.addIndexedChild(oamessagechoicebean);
}

How to capture its Value

String PoplistValue = oapagecontext.getParameter("xxAddAsgmtApplyAction");

Sunday, April 5, 2009

How to Capture LOV Event

if (pageContext.isLovEvent())
      {
      System.out.println("Inside LOV Event");
      String lovInputSourceId = pageContext.getLovInputSourceId();
//checking which lov event is fired.
//Below EmployeeLovInput is the ID of messageLovInput
   if ("EmployeeLovInput".equals(lovInputSourceId))
       {
         //Invokes AM Method 
            am.invokeMethod("setExtraInfo");
       }
}

The pageContext.isLovEvent method returns true/Fires if the event value is LOV_UPDATE (meaning the user selected a value from the LOV modal window), or LOV_VALIDATE (meaning the user tabbed out of the LOV input field on the base page).

Things good to know

Validation View Object - A view object created exclusively for the purpose of performing light-weight SQL validation on behalf of entity objects or their experts.


Validation Application Module - An application module created exclusively for the purpose of grouping and providing transaction context to related validation view objects. Typically, a standalone entity object or the top-level entity object in a composition would have an associated validation application module.


Root Application Module - Each pageLayout region in an OA Framework application is associated with a "root" application module which groups related services and establishes the transaction context.

This transaction context can be shared by multiple pages if they all reference the same root application module, and instruct the framework to retain this application module (not return it to the pool) when navigating from page to page within the transaction task.


View Link - Establishes a master/detail relationship between two view objects


Entity Expert - A special singleton class registered with an entity object (EO) that performs operations on behalf of the EO.

Association Object - BC4J association objects implement the relationships between entity objects. For example, a purchase order header can reference a supplier, or it can own its order lines.

Attribute Set - Bundles of region or item properties that can be reused either as is or with modifications. For example, all buttons sharing the same attribute set would have the same label and Alt text.

How to call SRS Window in OAF

Controller PFR Code
import oracle.apps.fnd.framework.webui.OAUrl;

StringBuffer l_buffer = new StringBuffer();
StringBuffer l_buffer1 = new StringBuffer();
l_buffer.append("javascript:mywin = openWindow(top, '");
l_buffer1.append("&akRegionApplicationId="+"0");
l_buffer1.append("&akRegionCode="+"FNDCPREQUESTVIEWPAGE");
l_buffer1.append("&retainAM=Y");
String url = "/OA_HTML/OA.jsp?page="+l_buffer1.toString();
OAUrl popupUrl = new OAUrl(url, OAWebBeanConstants.ADD_BREAD_CRUMB_SAVE );
String strUrl = popupUrl.createURL(pageContext);
l_buffer.append(strUrl.toString());
l_buffer.append("', 'lovWindow', {width:750, height:550},false,'dialog',null);");
pageContext.putJavaScriptFunction("SomeName",l_buffer.toString());

Thanks
--Anil

Custom CSS

http://forums.oracle.com/forums/thread.jspa?threadID=1054912&tstart=0

Calling Procedure

AM Code:

public String CreateInvoice(String pamount,String ptype,String pnum,String perror)
{

String perror = null;
try
{
Connection conn = getOADBTransaction().getJdbcConnection();
CallableStatement cstmt = conn.prepareCall("{call add_invoice_proc(?,?,?,?)}");
cstmt.setString(1,pamount);
cstmt.setString(2,ptype);
cstmt.setString(3,pnum);
cstmt.registerOutParameter(4,Types.VARCHAR);
System.out.println("before calling");
cstmt.execute();
perror = cstmt.getString(4);/*****getting the out parameter*****/
System.out.println("after calling");
System.out.println("error is "+perror);
cstmt.close();
}
catch(Exception e)
{
e.printStackTrace();
}

return perror;
}



public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processFormRequest(pageContext, webBean);
if (pageContext.getParameter("Insert")!=null)
{
String amount = pageContext.getParameter("InvoiceAmount");
String type = pageContext.getParameter("InvoiceTypeLookupCode");
String number = pageContext.getParameter("InvoiceNum");
String error = "";
OAApplicationModule am = pageContext.getApplicationModule(webBean);
Serializable [] params = {amount,type,number,error};
am.invokeMethod("CreateInvoice",params);
System.out.println("getting the out param in CO");
String returnmsg =(String)am.invokeMethod("CreateInvoice",params);
System.out.println("after getting");
System.out.println("errorstring is "+returnmsg);
if (returnmsg != null)
{
throw new OAException(returnmsg,OAException.ERROR);
}
if (returnmsg==null)
{
throw new OAException("Invoice created Successfully",OAException.CONFIRMATION);
}
}
}

Import & Export Commands 11i & R12

This summary is not available. Please click here to view the post.

Programmatically Search / Custom Search Code

Controller Code

 // In the controller
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processFormRequest(webBean);
 ForumsAMImpl am1 = (ForumsAMImpl)pageContext.getApplicationModule(webBean);
 if(pageContext.getParameter("submit") != null)
    {
         pageContext.writeDiagnostics("Anil", "Calling Execute Method ", 1);
          am1.ExecuteQuery(pageContext, webBean);
   
    }
}

ApplicationModule Code

public void  ExecuteQuery(OAPageContext pageContext, OAWebBean webBean)
{
 String supID = pageContext.getParameter("SuppID1")+"";
 String supName = pageContext.getParameter("SupplierName")+"";
 String supSite = pageContext.getParameter("SupplierSiteID")+"";

 XXSupplierSiteVOImpl vo = getXXSupplierSiteVO1();
  
 Debug.log(pageContext, "SearchAMImpl", "SuppID1 = " + supID, 1);
 Debug.log(pageContext, "SearchAMImpl", "SupplierName = " + supName, 1);
 Debug.log(pageContext, "SearchAMImpl", "SupplierSiteID = " + supSite, 1);

   String strWhereClause = "";
   Object paramArray[] = new Object[10];
   int i = 1;

 if(!StringUtils.isNullOrEmpty(supName))
 {

  if(StringUtils.isNullOrEmpty(strWhereClause))
  {
    Debug.log(pageContext, "SearchAMImpl", "supName = " + supName, 1);
    strWhereClause = " SITE_NAME like :" + i;

    Debug.log(pageContext, "SearchAMImpl", " strWhereClause = " + strWhereClause, 1);
    paramArray[i] = supName+ "%";
   } 

else
    {
     i++;
     strWhereClause = strWhereClause + "AND SITE_NAME like :" + i;
     Debug.log(pageContext, "SearchAMImpl", "supName in else = " + i, 1);
     paramArray[i] = supName;
     }
     }
       
     Debug.log(pageContext, "SearchAMImpl", "Above SupplierID Check " + supID, 1);
     if(!StringUtils.isNullOrEmpty(supID))
      {
       Debug.log(pageContext, "SearchAMImpl", "Inside SupplierID Check " + supID, 1);
         
       if(StringUtils.isNullOrEmpty(strWhereClause))
       {
         strWhereClause = " SUPPLIER_ID = :" + i;
         Debug.log(pageContext, "SearchAMImpl", " strWhereClause = " + strWhereClause, 1);
         paramArray[i] = supID;
         Debug.log(pageContext, "SearchAMImpl", " supID is = " + supID, 1);
        }
      
      else
        {
          Debug.log(pageContext, "SearchAMImpl", "SUPPLIER_ID WhereClause ELSE " + supID, 1);
          i++;
          strWhereClause = strWhereClause + " and SUPPLIER_ID like :" + i;
          paramArray[i] = supID;
          Debug.log(pageContext, "SearchAMImpl", "paramArrayE " + paramArray[i], 1);
        }
       }

      Debug.log(pageContext, "SearchAMImpl", "Above supSite Check " + supSite, 1);
       if(!StringUtils.isNullOrEmpty(supSite))
        {
          Debug.log(pageContext, "SearchAMImpl", "Below supSite Check " + supSite, 1);
          if(StringUtils.isNullOrEmpty(strWhereClause))
        {
           strWhereClause = " SUPPLIER_SITE_ID = :" + i;
           paramArray[i] = supSite;
        } 

    else
         {
          Debug.log(pageContext, "SearchAMImpl", "SUPPLIER_SITE_ID WhereClause ELSE " + supSite, 1);
         i++;
         strWhereClause = strWhereClause + " AND SUPPLIER_SITE_ID = :" + i;
         paramArray[i] = supSite;
         Debug.log(pageContext, "SearchAMImpl", "paramArray " + paramArray[i], 1);
         }
        }
    
          vo.setWhereClause(null);
          vo.setWhereClauseParams(null);
     
         Debug.log(pageContext, "SearchAMImpl", "Anil SetWhereClause" + strWhereClause, 1);
         Debug.log(pageContext, "SearchAMImpl", "i value is " + i, 1);
         vo.setWhereClause(strWhereClause);
       
         for(int j = 0; j < i; j++)
          {
            Debug.log(pageContext, "SearchAMImpl", "bind index " + j, 1);
            if(paramArray[j + 1] != null)
              {
                 vo.setWhereClauseParam(j, paramArray[j + 1]);
                Debug.log(pageContext, "SearchAMImpl", "bind values from Array " + paramArray[j + 1], 1);
             }
          }

          Debug.log(pageContext, "SearchAMImpl", " **** Query 2 = " + vo.getQuery(), 1);
          vo.executeQuery();
 }

Deploying Personalizations

The Functional Administrator responsibility provides a simple UI that lets you both export meta data to XML files, and import XML files into a MDS repository.


1. You have to  set the profile option FND: Personalization Document Root Path (FND_PERZ_DOC_ROOT_PATH) to a root directory in your file system where your files are to be exported to or imported from.


2. Log in to the Oracle E-Business Suite under the Functional Administrator responsibility.

3. Select the Personalizations tab, then select the Import/Export sub tab.

4. Select the pages, regions or packages you wish to export, then select Export to File.

5. Once you export your meta data to XML files on the file system, you should login to the other Oracle E-Business Suite environment that you want to import these files.


6. To import the XML files from your file system into another MDS repository, login to the other Oracle E-Business Suite environment as a Functional Administrator. Select the Personalizations tab, then select the Import/Export sub tab. Select Exported Personalizations from the side navigation menu to display the Exported Personalizations page.



7. Select all the documents you wish to import and choose Import from File System.




You can review the personalization through  JDR_UTILS . It is a PL/SQL package that allows you to evaluate the list of personalization documents that are in your MDS repository.


For example, to see all
the personalization documents for the Notifications Worklist Table, execute the following command:

exec
jdr_utils.listcustomizations('/oracle/apps/fnd/wf/worklist/webui/AdvancWorklistRG');

Diagnosing Personalization Problems

About this Page link shows document path and all personalization documents

• MDS pages saved under /mds/comp/sub/file.xml
• XML files imported into MDS repository at customer site


Use the Functional Administrator Responsibility / Application Catalog Tool to disable individual personalization documents

• Turn off personalizations for the entire instance by setting the following profile to ‘Yes’
• Disable Self-service Personal / FND_DISABLE_OA_CUSTOMIZATIONS


Use SQL*Plus to see personalization registration
• Turn on diagnostic messaging in SQL*Plus
• SQL> set serveroutput on

//Review what personalization documents exist for a given page

• execute jdr_utils.listcustomizations('/oracle/apps/fnd/wf/worklist/webui/FullWorklistPG');

//Review a personalization document

• execute jdr_utils.printdocument('/oracle/apps/fnd/customizations/user/2662/wf/worklist/webui/
FullWorklistPG');

// Delete a personalization document

• execute jdr_utils.deletedocument('/oracle/apps/fnd/customizations/user/2662/wf/worklist/webui/
FullWorklistPG');

Diagnosing Extension Problems

Make sure to import the .jpx file with the substitution into MDS using JPXImporter

• Use the 'About this Page' link to find all dependent objects and make sure substitutions of your extended objects were successful

• Enabled through FND_DIAGNOSTICS profile



// Check to see if substitution file was uploaded

execute jdr_utils.listcustomizations('/oracle/apps/fnd/framework/toolbox/tutorial/server/PoSummaryVO');

// Review a substitution definition

execute jdr_utils.printdocument('/oracle/apps/fnd/framework/toolbox/tutorial/server/customizations/si
te/0/PoSummaryVO');


// delete a substitution definition

execute
jdr_utils.deletedocument('/oracle/apps/fnd/framework/toolbox/tutorial/server/customizations/site/0/PoSummaryVO);

commit;

Enable Debug Log on OAF Page

We can enable logging by setting the below profile option:-
• FND: Debug Log Enabled profile set to ‘Yes’
• Turn on low level statement logging for a single user to monitor
• FND: Debug Log Level= Statement


Another way of gathering the same info is the following:


• First enable profile option FND: Diagnostics then
• At the end of the existing URL add:  &aflog_level=Statement&aflog_module=*

• Use '*' for wildcard, not '%'. '%' is a special URL character)

Example:
• http://host:port/OA_HTML/OA.jsp?OAFunc=OAHOMEPAGE&aflog_level=STATEMENT&aflog_module=pa

You can see the log on screen by using by below code in your controller OR in Application ModuleImpl

For AM

getOADBTransaction().writeDiagnostics(this, "I am in the Application Module", 1);

For Controller


 pageContext.writeDiagnostics(this, "I am in Controller PFR", 1);

How to hide OAImageBean in Controller



import oracle.apps.fnd.framework.webui.beans.OAImageBean;
import oracle.apps.fnd.framework.OAViewObject;
import oracle.apps.fnd.framework.OARow;

 public void processRequest(OAPageContext pageContext, OAWebBean webBean)

{
 super.processRequest(pageContext, webBean);
OAApplicationModule am = pageContext.getApplicationModule(webBean);

String userid = pageContext.getUserId()+"";
if (userid.equals(pageContext.getUserId()+""));
{
OAViewObject oaviewobject1 =(OAViewObject)am.findViewObject("EmployeeEOVO1");
OAViewObject svo =(OAViewObject)am.findViewObject("StatusPVO1");
OARow row1 = (OARow)svo.first();

if (oaviewobject1 != null)
{
System.out.println("Inside");
oaviewobject1.reset(); //New line added
oaviewobject1.next(); //new line added
OARow row = (OARow)oaviewobject1.getCurrentRow();

String fullName = (String)row.getAttribute("Attribute1");

if (fullName.equals("A"))

{
OAImageBean imagebean = (OAImageBean)webBean.findChildRecursive("approved");
OAImageBean imagebean1 = (OAImageBean)webBean.findChildRecursive("rejected");
OAImageBean imagebean2 = (OAImageBean)webBean.findChildRecursive("inProcess");
imagebean.setRendered(true);
imagebean1.setRendered(false);
imagebean2.setRendered(false);
}

else if (email.equals("R"))
{
OAImageBean imagebean = (OAImageBean)webBean.findChildRecursive("approved");
OAImageBean imagebean1 = (OAImageBean)webBean.findChildRecursive("rejected");
OAImageBean imagebean2 = (OAImageBean)webBean.findChildRecursive("inProcess");
imagebean.setRendered(false);
imagebean1.setRendered(true);
imagebean2.setRendered(false);

}

else if (email.equals("W"))
{

OAImageBean imagebean = (OAImageBean)webBean.findChildRecursive("approved");
OAImageBean imagebean1 = (OAImageBean)webBean.findChildRecursive("rejected");
OAImageBean imagebean2 = (OAImageBean)webBean.findChildRecursive("inProcess");
imagebean.setRendered(false);
imagebean1.setRendered(false);
imagebean2.setRendered(true);

}

else

{
System.out.println("Inside ELSE");
OAImageBean imagebean = (OAImageBean)webBean.findChildRecursive("approved");
OAImageBean imagebean1 = (OAImageBean)webBean.findChildRecursive("rejected");
OAImageBean imagebean2 = (OAImageBean)webBean.findChildRecursive("inProcess");
imagebean.setRendered(false);
imagebean1.setRendered(false);
imagebean2.setRendered(false);

}
}
}
}

Deployment of Page in APPS - OAF

The steps in brief are :

· Development of the TestPagePG.xml page in local machine
· FTP the related source code/files to the Oracle APPS environment.
· Importing the page to the Database through Import Command.
· Registration of the page in the Oracle Apps environment.


On project compilation the class files along with xml files are generated in Myclasses.


The Folder Structure for xml pages and respective Controllers are as below
C:\Jdevhome\Jdev\myclasses\xxx\oracle\apps\fnd\framework\webui\*
C:\Jdevhome\Jdev\myclasses\xxx\oracle\apps\fnd\framework\server\*

The First step will be to move the files into the JAVA_TOP with the help of any FTP Tool.

Just drag and dropped the xxx  folder from local m/c to Apps Java top path.


Importing the XML files:

Run the import scripts for the Page and Regions.

The import command is


import C:\Jjdevhome\jdev\myprojects\xx\oracle\apps\fnd\framework\webui\TestPagePG.xml -rootdir C:\jdevhome\jdev\myprojects -username apps -password apps -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.255.35.20)(PORT=1525))(CONNECT_DATA=(SID=DEV)))"

The command is to be run from Jdeveloper/Jdevbin/Jdev/Bin from command prompt.

Registering the Main Page in APPS.


Login through System Administrator Resp.

Select Application -- Function.

1. Enter the Function Name, User Function Name and Description

2. Enter Properties (Tab) Type as SSWA jsp function






3. In Web HTML Tab enter the page path
OA.jsp?page=/xxx/oracle/apps/fnd/framework/webui/TestPG

Attach the function with a desired menu and then run from the respective responsibility.

Last and the important step :-- DONOT forget to bounce the Appache server.





How to Bounce Apache server in 11i & R12

1. Connect to the server through Putty.


Now write
1. cd $COMMON_TOP.


2. cd admin/scripts/



Now write adapcctl.sh stop and once the appache is stopped write adapcctl.sh start to start the Appache server.

To bounce Appache in R12

1. adapcctl.sh stop
2. adoacorectl.sh stop

3. adapcctl.sh start
4. adoacorectl.sh start

These scripts are in $INST_TOP/admin/scripts












Wednesday, April 1, 2009

Change the date Format from YYYY-MM-DD to DD-MM-YYYY

In Controller

import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.text.DateFormat;
import java.util.Date;

String newProjStartDate,newProjEndDate, sConvertNewStartDate, sConvertNewEndDate = null;


newProjStartDate= (String)pageContext.getSessionValue("newstartdate");
newProjEndDate= (String)pageContext.getSessionValue("newenddate");

try


{
DateFormat formatter ;
Date date, date1, date2, date3;
formatter = new SimpleDateFormat("yyyy-MM-dd");
date = formatter.parse(newProjStartDate);
date1 = formatter.parse(newProjEndDate);

pageContext.writeDiagnostics(this, "Anil date is =" + date, 1);
pageContext.writeDiagnostics(this, "Anil date1 is =" + date1, 1);

SimpleDateFormat formatterNew = new SimpleDateFormat("dd-MMM-yyyy");
sConvertNewStartDate=formatterNew.format(date);
sConvertNewEndDate=formatterNew.format(date1);

pageContext.writeDiagnostics(this, "sConvertStartDate date is =" + sConvertNewStartDate, 1);
pageContext.writeDiagnostics(this, "sConvertEndDate date1 is =" + sConvertNewEndDate, 1);

}

catch (ParseException e)

{
throw new IllegalArgumentException("Encountered Date format error "+ e);
}