Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Program Flow Logic →  Exception Handling →  Exceptions Before Class-Based Exceptions →  Non-Class-Based Exceptions 

RAISE

Short Reference

Other versions: 7.31 | 7.40 | 7.54

Syntax


RAISE exception. 

Effect

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.
  • Specify RAISE 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 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-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 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.

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.


Notes

  • The statement MESSAGE with the addition RAISING also 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.

Exceptions


Non-Catchable Exceptions

  • Cause: The raised exception was not handled by the caller.
    Runtime Error: RAISE_EXCEPTION