Class-Based Exceptions in ABAP
To understand the benefit of this concept, think about what you expect from effective exception handling:
· On the one hand, the control flow should be adapted to the new situation – that is, continue program execution, if possible, at the best possible place with regard to the error.
· Furthermore, information about the error should be provided, so that it is clear at runtime (or later) what happened and why.
In ABAP, class-based exceptions are objects of special exception classes. Each of these classes represents a specific error type. The process of raising an exception consists of instantiating such an exception object and changing the control flow at the same time. There are system exception classes, which represent system error types like the class CX_SY_ZERO_DIVIDE (division by zero), and exception classes, which the user can create himself. Technically, there is no difference between the two types. All exception classes, whether defined by the system or the user, inherit from the class CX_ROOT.