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 and enhancements

Former Member
0 Kudos

Hello, gurus.

Is there any official document that prohibits using commits within enhancements, badi implementations e.t.c.?

5 REPLIES 5

rajkumarnarasimman
Active Contributor
0 Kudos

Hi Igor,

  If we use the commit statement inside enhancement/exit/badi, rollback is not possible because we already saved the value in database using commit inside enhancement.

Please find the below document.

How To deal with Customer Exits and BAdIs - ERP SCM - SCN Wiki

Regards

Rajkumar Narasimman.

0 Kudos

Hi, Rajkumar.

But no every ehnancement is involved in database saving.

Maybe, Is there a document that contains a list of extensions that are prohibited commits?

0 Kudos

Dear Igor,


Igor Garanichev wrote:

But no every ehnancement is involved in database saving.

If my understanding is correct, Enhancement is nothing but our developer will write the code, there is a possibility that user can call BAPI + commit at any enhancement for any T-code.

Maybe, Is there a document that contains a list of extensions that are prohibited commits?

The document which you have requested I already shared above. Kindly go through it.

Regards

Rajkumar Narasimman

Former Member
0 Kudos

Basically, COMMIT shouldn't be written in Enhancements/User Exits/BAdIs because an enhancement/user exit/BAdI is part of a main program, and that main program has a COMMIT work of its own.

So if you write a commit in your exit, it will end the LUW for the main program, which was supposed to end at the end of the main program, or where it was written as part of standard code. This leads to inconsistencies with respect to results/data after the program run.

Hope it helps!

samantak_chatterjee
Active Contributor
0 Kudos

Hi Igor,

Yes, you are right in pointing out that there are no documentation or guide document that prohibits the usage of COMMIT WORK inside the BadI's or Customer Exits while implementing them. I also googled in SDN and in SAP Help and got the following link only. Here I found that the first few lines are of importance.

Please find the link here - Implementing the Function Module

As already pointed out and you might have found, any random COMMIT WORK will create more problems with regards to data consistency. So, it is always good to leave the data persistence functionality at the application level which will call the final commit work and complete the Logical Unit of Work (LUW). In case you have custom functionality, you can update/delete/modify the custom table in UPDATE Function Modules through update tasks.

Hope this will help you. Let me know your thoughts too.

Thanks,

Samantak.