You are on page 1of 4

Dialog processing after COMMIT WORK statement

How to perform dialog processing after commit work execution?


In general, we may come across the scenario where, some dialog processing needs to be done
after transaction commit work. Its explained here by considering a scenario.
After filling all necessary details in the delivery document, user clicks on save button to create
a delivery document. If any dialog processing (like pop-up to fill some details) required upon
successful execution of COMMIT WORK statement. In this case, we can approach below
method.
Let me explain this by creating a custom class.
Create an event handler method in the custom class ZTEST_HANDLER for the event
TRANSACTION_FINISHED of the standard class CL_SYSTEM_TRANSACTION_STATE.
Standard class: CL_SYSTEM_TRANSACTION_STATE
Event name

: TRANSACTION_FINISHED

Note: This event gets triggered as soon as the COMMIT WORK gets executed.
My custom class name

: ZTEST_HANDLER

My event handler method: CALL_DIALOG (Event TRANSACTION_FINISHED of standard class


CL_SYSTEM_TRANSACTION_STATE attached to this custom method)
1) Event handler method CALL_DIALOG

2) Event handler method: CALL_DIALOG detailed view

Once the COMMIT WORK for the transaction is executed, control comes to custom method
CALL_DIALOG method. Here we can check whether transaction got committed successfully or
rolled back by using interface parameter KIND as shown in below screen shot.

To get the control to the CALL_DIALOG method, we need to do SET HANDLER to register the
event in any user exit before transaction COMMIT WORK execution.
Here in this case, I registered event in a BADI, which gets triggered after pressing SAVE button
in the outbound delivery (VL01N/VL02N) and before COMMIT WORK execution.
Please find below screen shot of BADI method.

The Event TRANANSACTION_FINISHED of standard Class


CL_SYSTEM_TRANSACTION_STATE and its parameters are shown in below screen shots:

Attributes of Class CL_SYSTEM_TRANSACTION_STATE:

Note: We can use IMPORT and EXPORT statements to transfer data from BADI to the method
CALL_DIALOG.

You might also like