2005 Dec 12 11:51 AM
Hi Friends,
Can i execute and abap oo method on commit work.
similiar to perform form on commit.
thanx
2005 Dec 12 12:38 PM
Hi Kaushik!
This should be possible, but with a little bit different approach:
You can implement an event handler for the commit event. Then you have to register this method for the commit event. Have a look at program SAPMSSY0. In routines %_before_commit, %_commit and %_after_commit you will find some events, e.g.
* Raise event 'Commit Requested' for Object Manager
CALL METHOD cl_os_transaction_end_notifier=>raise_commit_requested.
, for which you might like to register your method.
Regards,
Christian
2005 Dec 12 12:38 PM
Hi Kaushik!
This should be possible, but with a little bit different approach:
You can implement an event handler for the commit event. Then you have to register this method for the commit event. Have a look at program SAPMSSY0. In routines %_before_commit, %_commit and %_after_commit you will find some events, e.g.
* Raise event 'Commit Requested' for Object Manager
CALL METHOD cl_os_transaction_end_notifier=>raise_commit_requested.
, for which you might like to register your method.
Regards,
Christian
2016 Jun 17 11:24 AM
This methods are now privates.
The only friend of cl_os_transaction_end_notifier is cl_os_transaction
which have the event : IF_OS_TRANSACTION~SAVE_REQUESTED.
So here what I've done :
In the class constructor :
data O_mngr type ref to if_os_transaction_manager.
data o_trans type ref to if_os_transaction.
O_mngr = cl_os_system=>get_transaction_manager( ).
O_tran = O_mngr->Get_current_transaction( ).
Set handler my-event for O_tran.
I hope it'll helps...
2016 Jun 17 12:09 PM
Please also note that you could do a loopback with a perform on commit to the class (need to be adapted for instance).
To do so create a module pool with 2 forms :
form register.
perform loopback on commit level 2147483647.
endform.
form loopback.
ZCL_MY_CLASS=>MY_LOOPBACK_ENTRY( ).
endform.
Please also note that IF_OS_TRANSACTION~SAVE_REQUESTED is raised on %_before_commit,
while PERFORM ON COMMIT is raised on %_commit, so a few later on.
This could be usefull when you need to register FM in update task at the very last moment.
Usefull link on Commit sequence :https://help.sap.com/abapdocu_70/en/ABAPCOMMIT.htm
And perform on commit : https://help.sap.com/abapdocu_70/en/ABAPPERFORM_SUBR.htm