Wednesday, 7 May 2014

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 :" +e, OAException.INFORMATION); 
 }

No comments:

Post a Comment