Thanks to Manoj.. Or Should I say, Lalith :-)
I found the solution to the problem.
The Solution:
1) Import the following Java classes
import com.sun.java.util.collections.ArrayList;
import oracle.apps.fnd.framework.OAException;
2) Create the following methods in the AMImpl.java file:
private void addToBundle(Exception ex)
{
ArrayList a = (ArrayList)getOADBTransaction().getTransientValue("BUNDLEDEXCEPTION");
if (a == null)
a = new ArrayList();
a.add(ex);
getOADBTransaction().putTransientValue("BUNDLEDEXCEPTION",a);
}
public void showBundledMsg()
{
ArrayList a = (ArrayList)getOADBTransaction().getTransientValue("BUNDLEDEXCEPTION");
getOADBTransaction().putTransientValue("BUNDLEDEXCEPTION",null);
if( a != null)
{
throw OAException.getBundledOAException(a);
}
}
3) Usage in AM methods:
Whenever there is a validation error, instead of doing a "throw new OAException()", do a "addToBundle(new OAException());". Also use a boolean flag say "showMsg" and set it to true whenever a validation error occurs.
if(SomeValidationError)
{
OAException msg = new OAException("XXTMG", "XXTMG_PV_VALID_FULLSKIDQTY", null,OAException.ERROR,null);
addToBundle(msg);
showMsg=true;
}
Finally when all the checking for validations is done, cheack the value of "showMsg". If it is true, call the "showBundledMsg" AM method
if(showMsg)//Some of the values entered into the OA page are incorrect
{
showBundledMsg();
showMsg=false;
}
Well, that solves our problem! :-)
No comments:
Post a Comment