Anil's Blog is Best Viewed on GOOGLE CHROME

Saturday, November 3, 2012

Dynamically enabling Totaling in Advanced Table

Dynamically enabling Totaling in Advanced Table

Oracle provide the functionality of Totaling for a column by 'Recalculate' button. This means whenever user updates the value of column, user have to click on 'Recalculate' button to see the updated value in Total bean.

We got a business requirement where it has to be happen automatically as soon as user tabs out of the amount field and to achieve this we have enabled a event (fire partial event) and checked in code that whenever this event gets fired, we looped through the View Object rows and set the updated value in Total Bean.

Here is the code that we have written to achieve this.

public void processRequest(OAPageContext pageContext, OAWebBean webBean)

 {

   super.processRequest(pageContext, webBean);

   if(pageContext.getSessionValue("ApplyTotal")!=null) {

       setTotal(pageContext.getSessionValue("ApplyTotal").toString(),pageContext,webBean) ; // Calling setTotal method to set the updated total value in Total Bean.

   }

public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)

{

super.processFormRequest(pageContext, webBean);

OAApplicationModule am = pageContext.getApplicationModule(webBean);

 if("updateTotal".equals(pageContext.getParameter(EVENT_PARAM))) //Total event fired

{
         OAViewObject vo = (OAViewObject)am.findViewObject("XXCreditCardVO1");
         Integer total  = 0;
         if(vo!=null){
         vo.first();
         while(vo.hasNext())  // Loop through VO rows

{
         if(vo.getCurrentRow().getAttribute("BilledAmount")!=null)
             total = total + Integer.parseInt(vo.getCurrentRow().getAttribute("BilledAmount").toString());
             vo.next();
         }
        pageContext.putSessionValue("ApplyTotal",total);  // Putting the value in session
        pageContext.forwardImmediatelyToCurrentPage(null,true, "Y");
     }

public void setTotal(String total, OAPageContext pageContext,OAWebBean webBean){

OAAdvancedTableBean tableBean = (OAAdvancedTableBean)webBean.findChildRecursive("

AdvTableRN");

if(tableBean != null)

{

OAColumnBean tableFooterBean = (OAColumnBean)tableBean.findChildRecursive("ReimbAmountClmn"); 

if (tableFooterBean != null)

{

OAMessageTextInputBean totalBean = (OAMessageTextInputBean)tableFooterBean.findChildRecursive("ReimbAmount");

if (totalBean != null)

{

String formattedTotal = total.toString();

totalBean.setAttributeValue(TABULAR_FUNCTION_VALUE_ATTR, formattedTotal);

}

}

}


Thanks

--Anil

Wednesday, August 8, 2012

Error : oracle.jbo.AttributeLoadException: JBO-27022:


We got this error message when we are upgrading Oracle11i  to R12.1.3 and many of self service screen are not working because of this issue.

Error Message


oracle.apps.fnd.framework.OAException: oracle.jbo.AttributeLoadException: JBO-27022: Failed to load value at index 84 with java object of type java.lang.String due to java.sql.SQLException.
at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:912)

-----Lines deleted------

## Detail 0 ##
java.sql.SQLException: Invalid column index
at oracle.jdbc.driver.OracleResultSetImpl.getObject(OracleResultSetImpl.java:1042)
at oracle.jbo.server.OracleSQLBuilderImpl.doLoadFromResultSet(OracleSQLBuilderImpl.java:1198)
at oracle.jbo.server.AttributeDefImpl.loadFromResultSet(AttributeDefImpl.java:1633)
at oracle.jbo.server.ViewRowImpl.populate(ViewRowImpl.java:2221)


Solution

The issue is coming because there is a difference between 11i and R12 VO attribute. In nutshell, new attributes has been added in R12 view object.

To resolve this issue, Copy the R12 view object files to Jdev 10G and do the substitution again and deploy the related files to R12 instance and bounce Apache.


Thanks
--Anil