To enable error situations in procedures to be handled by the caller, exceptions have been defined in the interface of function modules and methods. For global procedures, the exceptions were defined in the ABAP Workbench. For local methods, they were defined with the EXCEPTIONS addition of the METHODSstatement. Exceptions defined in this way can be raised within the procedure with the RAISEstatements and with the RAISING addition of the MESSAGEstatement.
Exceptions that are defined like this in the interface are handled using the EXCEPTIONS additions of the corresponding CALL statements. These exceptions cannot be forwarded in the call hierarchy. Not handling them leads to a runtime error.
By using the predefined exception ERROR_MESSAGE after the EXCEPTIONS addition of a procedure call, messages of type E and A sent with the MESSAGE statement can also be handled as exceptions.
The principle of these self-defined exceptions is explained in:
Since the class-based approach here is much more sophisticated and flexible, it is the preferred approach for new developments. The EXCEPTIONS and RAISING additions are mutually exclusive in the interface of a procedure.