Gyan Factory

Gyan Factory
SAP Technical Project Support

Friday, January 8, 2016

OO ABAP Exception classes [About Using CX_STATIC_CHECK] Resumable Exception

Once the exception is raised in a method, then the controller search for a suitable handler section either in the method or in the upper call hierarchy of the method. If some major part of the method is left after when an exception is raised those can be again executed by Resumable exception technique with RESUME keyword. With Resumable exception the CLEANUP block is not executed. The below post shows some variants of RESUMABLE EXCEPTION.
--------------------------------------------------------------------------------------------------------------------------------------
Step1.  The CHECK method signature declares that it can raise an resumable exception. Inside the CHECK method a resumable exception is raised. Execute the program.

Step2. After the resumable exception is raised the cleanup block is executed and then the catch block is executed. So we have the below output.

Step3. Here in stead of a straight catch statement we have some thing new like CATCH BEFORE UNWIND ..So there is significant change in the program flow. Once the exception is raised the cleanup section is not executed, rather the controller moves to the CATCH before unwind . Once the TRY.  CATCH BEFORE UNWIND.. ENDTRY. is finished the controller moves to the cleanup section and then finally moves to execute the remaining part on the RUN method.

Step4. So here we have the output.

Step5. One more variant of the resumable exception which is truely powerful. The RESUME keyword can only be used with CATCH BEFORE UNWIND combination with a RESUMABLE exception. When a Resumable exception is raised, the controller moves to the CATCH section without executing the CLEANUP section. In side that when RESUME command is executed, then the controller backs to the method check form where the exception is raised & then executed the line following the RAISE RESUMABLE EXCEPTION ( without cleanup block ) & Executes all the remaining part of the CHECK METHOD. Then after the controller comes back to the end of the ENDTRY of the RUN method and finishes the remaining part of the RUN method. Execute the program. 

Step6. So we have the below output.







--------------------------------------------------------------------------------------

No comments:

Post a Comment