Application Development and Automation 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: 
Read only

Enhancement Spots & COMMIT WORK statement

Former Member
0 Likes
1,260

Hi All,

I have read a SAP note which suggests that COMMIT WORK statements in Enhancement Spots or bADIs can cause errors.

Has anyone experienced this or confirm/explain this?

Thanks,

Gregor

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
752

Hi Gregor Brett,

BADIs are usually provided in the middle of any process. For eg, if I am creating a contract, so during save system will process half of the process and then my BADI is called so that I can provide any field value, letsay. But now if I commit my work in the BADI, then half the process will be commited to the database and will lead to erratic behaviour.

You it is not recommented to put commit in BADI or Enhancement Spot.

Hope this will resolve your query.

Regards,

Manish

4 REPLIES 4
Read only

Former Member
0 Likes
753

Hi Gregor Brett,

BADIs are usually provided in the middle of any process. For eg, if I am creating a contract, so during save system will process half of the process and then my BADI is called so that I can provide any field value, letsay. But now if I commit my work in the BADI, then half the process will be commited to the database and will lead to erratic behaviour.

You it is not recommented to put commit in BADI or Enhancement Spot.

Hope this will resolve your query.

Regards,

Manish

Read only

0 Likes
752

Thank you both

Read only

Former Member
0 Likes
752

commit statement in userexit/BADI:

You should not do that.

After the user exits/BADI code is triggered, the transaction's own commits statements will commit the database anyway

Read only

Former Member
0 Likes
752

Due to transaction processing techniques, the commit work is usually at the end of a transaction. When a transaction starts, the database is in a consistent state after that the data is in intermmediate state when you are making changes or additions or deletions in the transaction. Once all the data is changed and you confirm that it is valid, you save your work , upon save a commit work is explicitly executed (i.e commit work statement is at the end of the save procedure of the program). Imagine what will happen if there is a commit work in between a intermmediate state of the data, the data will be inconsistent.

For further explantion to your query check this [link|http://help.sap.com/saphelp_nw04/Helpdata/EN/41/7af4b9a79e11d1950f0000e82de14a/frameset.htm]

Kind regards,

Advait