Class-based exceptions
As the object-oriented programming philosophy was incorporated into ABAP programming, the exceptions concept had to evolve as well. As programs grew and used more classes and objects, the exceptions were eventually migrated to class-based programming. There was also a more practical reason for this move-defining exception, since an object allows for passing more detailed information on what happened to the caller, thereby letting the developer define better-tailored reactions.
The newly created exception objects—either standard or custom ones—are children of the same master abstract class, CX_ROOT
, and therefore all have common attributes: TEXTID
, PREVIOUS
, and IS_RESUMABLE
, and the common methods, GET_TEXT
, GET_LONGTEXT
, and GET_SOURCE_POSITION
.
The CX_ROOT
class is the most general exception class and, as such, contains very little information about the specific causes of the exception. Thus, there is a whole hierarchy of subclasses grouped into three elements that...