Non-class-based exceptions can be defined in the interfaces of function modules and methods. These exceptions are defined as follows:
- In methods of local classes, by assigning a name for the exception after the addition
EXCEPTIONSof the statement
- In methods of global classes or function modules, by assigning a name for the exception in Class Builder or Function Builder. Here, the radio button for exception classes is not selected.
The statement RAISE
EXCEPTION or the addition
THROW in a
conditional expression cannot be used to raise class-based exceptions in a method or a function module in whose interface non-class-based exceptions are defined.
Before class-based exceptions were introduced, all exceptions defined in the interface of methods of global classes or function modules were non-class-based.
Non-class-based exceptions are raised by the following statements:
The handling of non-class-based exceptions is made possible by the addition
method calls and
function module calls. Number values are assigned to
the exceptions and are used to fill the system field
sy-subrc when the exception
is raised. The actual error handling takes place after the call, when
sy-subrc is evaluated.
- The exceptions that can be defined in the interfaces of methods and function modules are not real exceptions, since they do not modify the control flow and they just end the processing of the
procedure prematurely and set the return code
- RFC currently allows only classic exception handling. Class-based exception handling is only possible in a different release track.