Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

What can be used instead of COMMIT WORK in a user-exit?

Former Member
0 Kudos

Hi,

I am calling a BAPI inside a USER-EXIT, since I cannot use 'COMMIT WORK' or 'BAPI_TRANSACTION_COMMIT', what can i use to commit it to the db?

Kindly Reply.

Sneha

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Can I use a COMMIT WORK or BAPI_TRANSACTION_COMMIT inside a Z.... FM which is being called inside a user exit?

6 REPLIES 6

Private_Member_49934
Contributor
0 Kudos

When is the user exit getting triggered? If it is before the transaction does commit then you don't need to do a commit.  You standard transaciton will do the commit for you.

if it is in update task, then create a z-fm Put your code in it with commit and call the FM in background task.

if it is after the save and not in update task then I guess you can do you commit in the exit

Former Member
0 Kudos

Hi Sneha

Check the following thread,

http://scn.sap.com/thread/990840

Regards,

Xineohpi

Former Member
0 Kudos

Thank you.

I'll create a z_,,, FM and select the update module in the form builder. guess that will help solve my problem.

raymond_giuseppi
Active Contributor

You can try to build a FM RFC enabled, and in your user-exit CALL this FM IN BACKGROUND TASK [AS SEPARATE UNIT]. The FM will wait and be submitted during the COMMIT WORK, it will exc=execute in its own LUW and you will be allowed to program what you want in it.

Regards,
Raymond

Former Member
0 Kudos

Can I use a COMMIT WORK or BAPI_TRANSACTION_COMMIT inside a Z.... FM which is being called inside a user exit?

0 Kudos

Yes if you called your FM in BACKGROUND TASK. No if you called it immediately or IN UPDATE TASK.

Regards,

Raymond