Total Pageviews

Saturday 12 December 2020

Raise bundle exceptions using raiseBundledOAAttrValException with example in OAF

package xx.oracle.apps.icx.por.rcv.webui;
import com.sun.java.util.collections.ArrayList;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import oracle.apps.fnd.common.MessageToken;
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.OAAttrValException;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.OAViewObject;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.apps.fnd.framework.webui.beans.OAWebBeanTable;
import oracle.apps.icx.por.rcv.server.ReturnItemsVOImpl;
import oracle.apps.icx.por.rcv.webui.RtnSrchCO;
import oracle.jbo.Row;

public class XXRtnSrchCO6 extends RtnSrchCO
{
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
pageContext.writeDiagnostics(this, "Dbg : XXRtnSrchCO Start Process From Request ",1);

OAApplicationModule am = pageContext.getApplicationModule(webBean);
ReturnItemsVOImpl vo1 = (ReturnItemsVOImpl)am.findViewObject("ReturnItemsVO");

String str1 = null;
String str2 = null;
String str3 = null;
String usrId = null;

try
{
str1 = pageContext.getParameter("event");
}
catch(Exception e)
{
pageContext.writeDiagnostics(this, "Dbg : Exception at str1 "+e,1);
}

try
{
str2 = pageContext.getParameter("value");
}
catch(Exception e)
{
pageContext.writeDiagnostics(this, "Dbg : Exception at str2 "+e,1);
}

try
{
str3 = pageContext.getParameter("source");
}
catch(Exception e)
{
pageContext.writeDiagnostics(this, "Dbg : Exception at str3 "+e,1);
}

try
{
usrId = ""+pageContext.getUserId();
}
catch(Exception e)
{
pageContext.writeDiagnostics(this, "Dbg : Exception at usrId "+e,1);
}

pageContext.writeDiagnostics(this, "Dbg : usrId "+usrId,1);
pageContext.writeDiagnostics(this, "Dbg : str1 "+str1,1);
pageContext.writeDiagnostics(this, "Dbg : str2 "+str2,1);
pageContext.writeDiagnostics(this, "Dbg : str3 "+str3,1);

if (("goto".equals(str1)) && ("NavigationBar".equals(str3)) && ("2".equals(str2)))
{
pageContext.writeDiagnostics(this, "Dbg : Next button pressed. ",1);

Object rtnSrchVoName = (String)pageContext.getTransactionValue("RtnSrchVOName");
pageContext.writeDiagnostics(this, "Dbg : rtnSrchVoName "+(String)rtnSrchVoName, 1);

OAWebBeanTable resultsTblBean = (OAWebBeanTable)webBean.findIndexedChildRecursive("ResultsTableRN");

if (resultsTblBean != null)
{
pageContext.writeDiagnostics(this, "Dbg : resultsTblBean Entered", 1);

resultsTblBean.setViewUsageName((String)rtnSrchVoName);
OAViewObject rtnSrchVO = (OAViewObject)am.findViewObject((String)rtnSrchVoName);

if(rtnSrchVO!=null)
{
Row[] headrRow = rtnSrchVO.getAllRowsInRange();

pageContext.writeDiagnostics(this, "Dbg : Length of rtnSrchVO rows is "+headrRow.length, 1);
ArrayList errMsg = new ArrayList();

if(headrRow.length >0)
{
for (int j = 0; j < headrRow.length; j++)
{
Row currRow = headrRow[j];
oracle.jbo.domain.Number returnQty = null;

try
{
returnQty = (oracle.jbo.domain.Number)currRow.getAttribute("ReturnQuantity");
}
catch (Exception ex)
{
pageContext.writeDiagnostics(this,"Dbg : returnQty Exception "+ex,1);
}

pageContext.writeDiagnostics(this,"Dbg : returnQty "+returnQty,1);

if(returnQty!=null)
{
String query4 = "select xx_rcpt_oaf_pkg.is_rcpt_qty_elig(:1) from dual";
String isValidDecimal =null;

try
{
PreparedStatement pStmt = am.getOADBTransaction().createPreparedStatement(query4, 1);
pStmt.setString(1,returnQty.toString());

for(ResultSet rs = pStmt.executeQuery(); rs.next();)
{
if(rs != null)
{
isValidDecimal = rs.getString(1);
}
}

pStmt.close();
}
catch(Exception e)
{
pageContext.writeDiagnostics(this,"Dbg : isValidDecimal Exception "+e,1);
}

pageContext.writeDiagnostics(this,"Dbg : isValidDecimal "+isValidDecimal,1);

if(isValidDecimal!=null && isValidDecimal.length()>0 && isValidDecimal.equalsIgnoreCase("Y"))
{
pageContext.writeDiagnostics(this,"Dbg : Only 2 Decimal places are allowed at Receipt Quantity ",1);
OAAttrValException ex1 = new OAAttrValException(111,rtnSrchVO.getFullName(),currRow.getKey(),"ReturnQuantity",returnQty,"XX","XX_RCPT_QTY_DCML_MSG", null, (byte)0);
errMsg.add(ex1);
}
}
}

if (errMsg.size()> 0)
{
  pageContext.writeDiagnostics(this,"Dbg : Throwing Bundle exceptions     ",1);
  OAAttrValException.raiseBundledOAAttrValException(errMsg);
}
}
}
}
}
pageContext.writeDiagnostics(this, "Dbg : XXRtnSrchCO Process From Request End",1);
super.processFormRequest(pageContext, webBean);
}

}

Displaying Exception Messages in OAF

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

   if(pageContext.getParameter("item1")!=null)
   {
    String name=pageContext.getParameter("item6");
    throw new OAException(name,OAException.ERROR);
   }
   if(pageContext.getParameter("item1")!=null)
   {
    String name=pageContext.getParameter("item6");
    throw new OAException(name,OAException.CONFIRMATION);
   }
   if(pageContext.getParameter("item1")!=null)
   {
    String name=pageContext.getParameter("item6");
    throw new OAException(name,OAException.WARNING);
   }
}

Useful OAF Profiles

Personalize Self-Service Defn - To enable the personalization link on every page 

FND: Personalization Region Link Enabled - To enable the personalization link on every region 

FND: Diagnostics - To enable diagnostics on OAF page 

FND: Personalization Seeding Mode - To allow edition of custom personalization 

Disable Self-Service Personal - For disabling all personalization’s 

Fnd Xliff Export Root Path - Use this profile option to set the root path used to generate the full path where the Xliff files are exported to when users extract their translated personalization using the Extract Translation Files page in OA Personalization Framework. The permissions for the root path directory that you specify must be set to read, write, create for all users, using chmod 777 [dir_path].

Xliff Import Root Path - Use this profile option to set the root path used to derive the full path from where the Xliff files are uploaded when users use the Upload Translations page in OA Personalization Framework to upload translated personalization. 

FND: Personalization Document Root Path - Use this profile option to define the root path where personalization documents are exported to or imported from when users use the Database page or the File System page of the Functional Administrator responsibility's Document Manager, respectively. We recommend you set this profile to the $APPL_TOP staging area: $APP_TOP/<CompanyIdentifier>/<CustomProductShortName>/<product-version>/mds/webui of the current deployed environment, where personalization documents are to be imported from or exported to. This profile option should be set at the Site level.

Unable to launch the Java Virtual Machine Located at path: ..\..\jdk\jre\bin\client\jvm.dll

 Below error will receive when attempting to install jDeveloper 10g for OAF on a Windows 10 desktop machine.

Error: Unable to launch the Java Virtual Machine Located at path: ..\..\jdk\jre\bin\client\jvm.dll

Solution: Please do the following setup to fix the above issue.

Run regedit (remember to run it as the administrator)  from your system

  • Expand HKEY_LOCAL_MACHINE 
  • Expand SOFTWARE 
  • Expand Microsoft 
  • Expand Windows 
  • Expand CurrentVersion 
  • Expand App Paths 
  • At App Paths, add a new KEY Name it: jdevW.exe Expand jdevW.exe 
  • Modify the (DEFAULT) value to the full pathway to the jdeveloper executable 
  • ex: "c:\jdev\jdevbin\jdev\bin\jdevW.exe" 
  • Create a new STRING VALUE called PATH and set it value to the jdeveloper pathway 
  • ex: "c:\Jdev\jdevbin\jdk\jre\bin" Save and close regedit