Pages

Recently Viewed

Tuesday, January 31, 2012

Multiple Error Messages in OAF

Requirement – How to raise multiple error messages as multiline on OAF pages.

Solution –  1) Create and initialize new ArrayList object
       2) Define the error messages in array list
       3) Raise bundled eception method  

Example -
    ArrayList  errMsg = New ArrayList();                 
 
    errMsg.add(new OAException("Who is Lucifer"));
    errMsg.add(new OAException("Ra-One will kill Lucifer"));
    errMsg.add(new OAException("G-One is protector"));      
    
   OAException.raiseBundledOAException(errMsg);    

Output –
1.       Who is Lucifer
2.       Ra-One will kill Lucifer
3.       G-One is protector
------------------------------------------------------------------------------------------------------
Exception -  If above method is being implemented inside a try/catch block, It might not throw expected error message.So either implement above outside Try/catch block or use below steps to handle this inside try/catch.       
             
1)      Create array list object at global level
      ArrayList  errMsg = New ArrayList();     
            
2)      Define the messages inside the try block and raise exception with custom message
 try {
    errMsg.add(new OAException("Who is Lucifer"));
    errMsg.add(new OAException("Ra-One will kill Lucifer"));
    errMsg.add(new OAException("G-One is protector"));      
    throw new OAException("Sandeep");   
     }           

3)      Handle this implementation inside the catch block
catch(Exception e)
  {
  String a="oracle.apps.fnd.framework.OAException: Sandeep";
  if (a.equals(e.toString()))
  {   OAException.raiseBundledOAException(errMsg);    }
  else
  {   throw new OAException("Exception Has been found in code 28:" +e, OAException.INFORMATION); 
 }

1 comment:

  1. Hi Sandeep,

    For this case can't we stop line numbers while printing the error messages by line.

    Regards,
    Vijay

    ReplyDelete