Get Example source ABAP code based on a different SAP table
ID RAISE-EXCEPTION-OLD • RAISE ABAP Statement
RAISE> Short Reference >
ABAP_SYNTAX RAISE exception.>
What does it do? This statement raises the non-class-based exception> exception>.
RAISE> can be specified in a method only if the non-class-based exception is defined in the interface of the method.
RAISE> should be specified in function modules only if the non-class-based exception is defined in the interface of the function module.
It is possible to specify RAISE> in all other positions, but it is not recommended. After the exception exception> is raised, the system behaves as follows:
If the exception is raised in a method or function module whose caller assigns a return code to the exception, the procedure> is terminated immediately, the system returns to the calling position, and the system field sy-subrc> is set according to the assignment.
If the exception is raised in a method or function module whose caller does not assign a return code to the exception, a runtime error is then raised 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 one is found and the exception is defined in it, the system behaves as if the exception were 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 terminates the execution of the program. This form of the statement RAISE> cannot be used in the same processing block> as the statement RAISE EXCEPTION>> or the addition THROW>> in a conditional expression> to raise class-based exceptions.
Latest notes:
The statement MESSAGE> with the addition RAISING>> also raises a non-class-based exception and is to be preferred in cases in which non-class-based exceptions still have to be used, 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. NON_V5_HINTS ABAP_HINT_END
Example ABAP Coding
Raising of a non-class-based exception in a method. ABEXA 00506 ABAP_EXAMPLE_END
Runtime Exceptions
Non-catchable Exceptions
Reason for error:
The raised exception was not handled by the caller.