This statement raises the non class-based exception
RAISEcan be specified in a method only if the non-class-based exception is defined in the interface of the method.
RAISEin function modules only if the non-class-based exception is defined in the interface of the function module.
It is possible to specify
RAISEin all other positions, but this is not recommended.
After the exception
exception is raised, the system proceeds as follows:
If the exception is raised in a method or function module whose caller assigns a return value to the exception, then the
procedure ends immediately,
the system returns to the calling position, and the system field
sy-subrcis set according to the assignment.
- If the exception is raised in a method or function module whose caller does not assign a return value to the exception, a runtime error is then triggered whose short dump contains the name of the exception.
- If the exception is raised in a subroutine, the system searches for the first function module in the procedures of the preceding call stack. If it finds a function module of this type and the exception is defined in it, the system acts as though the exception was raised in this function module. Otherwise, a runtime error occurs.
In all other processing blocks, raising a non-class-based exception produces a runtime error that immediately ends the program.
MESSAGEwith the addition
RAISINGalso raises a non-class-based exception. In cases in which non-class-based exceptions are still used, this statement is preferred instead of
RAISE, because it offers the option of adding a text to the exception.
If a procedure is exited by raising an exception, the content of the formal parameter for which the
pass by value is defined is not assigned to the respective actual parameters.
Cause: The raised exception was not handled by the caller.