Documentation View

We are hiring and constantly growing! Have a look through our vacancies to find the right role for you!

ABAPRAISE_EXCEPTION - RAISE EXCEPTION

ABAPRAISE_EXCEPTION - RAISE EXCEPTION

General Data in Customer Master   CPI1466 during Backup  
This documentation is copyright by SAP AG.
SAP E-Book

RAISE

Short Reference



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

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.

Example

Raising of a non-class-based exception in a method.

Exceptions

Non-Catchable Exceptions

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






General Data in Customer Master   RFUMSV00 - Advance Return for Tax on Sales/Purchases  
This documentation is copyright by SAP AG.

Length: 4008 Date: 20230206 Time: 112026     sap01-206 ( 62 ms )