Monday, March 21, 2011

ABAP Exceptions

Knowing the types of exception handling in ABAP could be helpful in your application.


I learned so far that there are two types of handling exceptions in ABAP. It is through a non-class based and a class based exception classes:


SUMMARY: Untick the class exception in the exception parameter of a method to create a non-class based.


Creating a class based should start your class name in CX_*. Watch out for my next blog.


NOTE:  this is the proper syntax for the attribute '&' as shown in the pic below:
class based attribute check box

Just an addition, you may want also to catch any generic SAP error by using the syntax below:

data OREF type ref to CX_ROOT.
data TEXT type STRING.

try.
    [statement]

catch CX_ROOT into OREF.
      TEXT = OREF->GET_TEXT( ). 
endtry.





Please check this link from SAP SDN!

No comments:

Post a Comment