Skip to Content

Perform on rollback

If you know “perform on rollback”, stop reading. But I experienced that a lot of people do not know about “perform on rollback”

The situation was that I had to add some functionality to a process which “provides” me with a rollback, but I had to store the information that I at least attempted to do something…so either change the complete framework or perform on rollback

Unfortunately perform-on-rollback can not have any parameters and therfore I did the following:

  1. create one class with a static class method which actually does what I want to be done: save data to dataase, e.g. CL_STORAGE=>SAVE and
  2. create one class method which provides the data to the SAVE method, e.g. CL_STORAGE=>SET_DATA.
  3. Also create a method which you have to call once to “register” the SAVE-method to be called regardless of the rollback/commit.
  4. Then create a form routine which calls the CL_STORAGE=>SAVE method and
  5. create one form routine which does the perform-on-rollback.

This will somehow look like:

*.
form execute_regardless.
 perform store_my_data on ROLLBACK.
 perform store_my_data on COMMIT.
endform.".
*.
FORM store_my_data.
 CL_STORAGE=>SAVE( ).
 CL_STORAGE=>CLEANUP( ).
ENDFORM.".
And the class methods:

METHOD register.
 PERFORM execute_regardless IN PROGRAM blahblubb.
ENDMETHOD.
You can imagine the rest…

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply