Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Program Flow Logic →  Exception Handling →  Class-Based Exceptions →  TRY 

RESUME

Quick Reference

Other versions: 7.31 | 7.40 | 7.54

Syntax


RESUME. 

Effect

This statement exits the CATCH handling of a resumable exception and resumes processing after the place where the exception was raised. The statement RESUME can only be executed in a CATCH block of a TRY control structure for which the addition BEFORE UNWIND is declared. When exception handling is exited using RESUME, the context of the exception is not deleted and any CLEANUP blocks are not executed.

The following are prerequisites for resuming processing:

  • The exception was raised as a resumable exception by the addition RESUMABLE of the statement RAISE EXCEPTION or by the addition THROW in a conditional expression.
  • The exception was declared with the addition RESUMABLE of RAISING in the interface of all procedures from which it was propagated (if it is not an exception derived from CX_NO_CHECK).

If these points do not apply, an exception of the class CX_SY_ILLEGAL_HANDLER is raised. To check whether the prerequisites are met, the instance attribute IS_RESUMABLE with type abap_bool of the current exception object can be checked. The value of the attribute is set using the addition INTO when the statements CATCH and CLEANUP are executed as long as the addition BEFORE UNWIND is specified for CATCH.


Notes

  • If the resumable exception was not raised by the variant RAISE RESUMABLE EXCEPTION oref, the handler can send information to the raiser of the event by assigning values to appropriate attributes of the exception object.
  • Resuming processing after an exception is particularly useful if the exception was raised when a special method was called, such as a constructor or a functional method in an operand position.
  • If a CATCH block is not exited using RESUME when handling a resumable exception, the program does not continue in the context of the statement that raised the exception (as described in System Response After a Class-Based Exception). This context is deleted when the CATCH block is exited, at the latest.
  • The transformation option OPTIONS exception = 'resumable' can be used to turn exceptions of the class CX_ST_DESERIALIZATION_ERROR that are raised in Simple Transformations into resumable exceptions. If CATCH BEFORE UNWIND is used, the canceled transformation can also be resumed after the break using RESUME.

Example

Uses the statement RESUME in the handling of a resumable exception cx_demo.

CLASS cx_demo DEFINITION INHERITING FROM cx_static_check. 
ENDCLASS. 

CLASS cls DEFINITION. 
  PUBLIC SECTION. 
    CLASS-METHODS meth RAISING RESUMABLE(cx_demo). 
ENDCLASS. 

CLASS cls IMPLEMENTATION. 
  METHOD meth. 
    ... 
    RAISE RESUMABLE EXCEPTION TYPE cx_demo. 
    cl_demo_output=>display( 'Resumed ...' ). 
    ... 
  ENDMETHOD. 
ENDCLASS. 

START-OF-SELECTION. 
  TRY. 
      cls=>meth( ). 
    CATCH BEFORE UNWIND cx_demo. 
      RESUME. 
  ENDTRY. 

Exceptions

Handleable Exceptions

CX_SY_ILLEGAL_HANDLER

  • Cause: Exception cannot be resumed. The ID of the exception text is NOT_RESUMABLE
    Runtime error: UNCAUGHT_EXCEPTION