Skip to Content


Hello SDNers,

I have the following construct in my code:

  TRY .
      val1    = persist_class->get_value( key1 ).       val2    = persist_class->get_value( key2 ). " --> exception is raised here       val3    = persist_class->get_value( key3 ).     CATCH exception.   ENDTRY.

I want the next statement

val3    = persist_class->get_value( key3 ).

to be executed after the exception has been handled.

I thought of using "resumable exceptions". So I read the SAP documentation on the topic & then debugged the program DEMO_CATCH_EXCEPTION.

IMO "resumable" is w.r.t. the procedure which RAISES the exception & not the HANDLER. Is my understanding correct? If yes, then what is their utility?

Thanks for your replies.



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Sep 01, 2015 at 03:53 PM

    Your understanding is correct. The reason for resumable exceptions it to give the calling program the control if the error is fatal or not.

    If you want the behavior you describe you raise the resumable exception in the get_value( ) method and when it comes back you perform a RETURN to exit the method. This will then continue with the next command after the method call.

    You can also do it without resumable exceptions by putting every call to get_value( ) in its own TRY-CATCH.

    The documentation is pretty clear:

    There are two different exception handling cases:

    1. The context in which the exception was raised is deleted completely before or after handling. This removes all procedures from the memory (and also their local data, which was called from the handler context and which caused the exception); handling is resumed depending on how the handler is exited.

    2. The context in which the exception was raised is retained and the program is resumed after the statement that raised the exception.

    A prerequisite for the second case are resumable exceptions. These exceptions must be raised with the addition RESUMABLE of the statement RAISE EXCEPTION and declared using the addition RESUMABLE in the interface of the procedures from which they were propagated. The statement RESUME is used to resume the program.

    The documentation of the RESUME command:

    This statement exits the CATCH handling of a resumable exception and resumes processing after the statement that raised the exception. This statement 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.

    Add comment
    10|10000 characters needed characters exceeded