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: 

COMMIT WORK statement in enhancement(User exit, BADI, enhancement spot, enhancement section, BTE)

Former Member
0 Kudos

Dear Experts,

We are having data inconsistencies when posting through MIGO transaction. Based on Note 92550 & 1284654, the use of COMMIT WORK statement in the implementation of BADI: MB_DOCUMENT_BADI is one of several elements in the enhancement that causing it. We replaced the implementation of BADI: MB_DOCUMENT_BADI with other enhancement implementations:

-. Enhancement Section: FCODE_BEARBEITEN_01 in include MM07MFF0_FCODE_BEARBEITEN

-. Enhancement Point: GOODS_MOVEMENT_FILL_05 in include LMIGOKG1

What we want to know is:

1. Is it safe or at least how can we know if it is safe to use COMMIT WORK statement on those enhancement implementations?

2. Does the use of COMMIT WORK statement restriction applies to all enhancement like user exit, BADI, enhancement section, enhancement point or it's just applies to certain or specific enhancement?

3. How can we use some function that needs COMMIT WORK statement, for example BAPI: BAPI_GOODSMVT_CREATE(Note 457499) on enhancement that must not contain COMMIT WORK statement?

Thank You,

2 REPLIES 2

Saumitra_MT
Explorer
0 Kudos

Hi Rolando,

Taking your questions one at a time:-

1. Is it safe to use COMMIT WORK statement on enhancement implementation.

COMMIT WORK is used for completing any of the change process( like insert, delete, append, update ) for a particular data base table. And Enhancements are mainly used to modify the flow to the current SAP Program. Thus use it only when  you are pretty sure that changes in the Database have to be done.

2.  Commit work restriction applies to all enhancements, exits and other mentioned objects.

COMMIT WORK is used to make the changes that is being carried out in the dictionary permanent, So Unless any of the objects are there to carry out table entry changes, there is no requirement to use COMMIT WORK.

Else if there is a need of changes, commit work should be used.

3. Use of Commit Work after using BAPI creating or changing inside an enhancement.

Use of COMMIT WORK is not advisable after using a BAPI for creation(or changes carried ) of a particular object, instead we should use 'BAPI_TRANSACTION_COMMIT' as the later clears out normal buffers as well as BAPI Buffers, to carry out the changes, compaired to COMMIT WORK which leaves BAPI buffers with data, thus preventing the data inconsistencies that may be caused, by lack of primary memory space and other reasons to carry out the process.

and for using it Just call the FM BAPI_TRANSACTION_COMMIT, after you have made a call to  the BAPI (BAPI_GOODSMVT_CREATE) Function Module.

Hope this helps you.

Regards,

Saumitra

Former Member
0 Kudos

Rolando,

1. COMMIT WORK is a statement that is used to make sure the operation ( like a BAPI call in your case) is done without fail. Yes, you can use..again it depends if it is really necessary at that place.

2. Again, since we are doing this change at the database level, it would affect (based on your operation) in all the exits wherever used.

3. Use 'BAPI_TRANSACTION_COMMIT'. Some BAPI`s will have an internal commit. However in your case, you might need to call this explicitly.

Regards,
Guru