cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI_TRANSACTION_COMMIT - general call?

christian_kutsch
Explorer
0 Kudos

Hello everybody,

Can problems arise (at booking or lock) if the BAPI_TRANSACTION_COMMIT is called by default? No matter if necessary or not for the BAPI.

For example, in a chain of BAPIs after every single BAPI.

Furthermore, can it also be a problem if a commit is already set in a Z-BAPI and then BAPI_TRANSACTION_COMMIT is called again?

Best regards,

Christian

Accepted Solutions (0)

Answers (2)

Answers (2)

SimoneMilesi
Active Contributor

Hi Christian,

@ nawanandana.edirisinghe explained well what happens if you do not call the BAPI_TRANSACTION_COMMIT after invoking an Update/Creation BAPI.

After a READING one, things are a bit more complex: invoking a DB update has no effect on the BAPIs themselves, but you should ask yourself if it could effect your custom code (i.e. some kind of Z-table writing).

If I'd be you, I'd remove all the useless BAPI_TRANSACTION_COMMIT and, if I was you, I'd also add the BAPI_TRANSACTION_ROLLBACK instead of COMMIT one if you face an error.

p244500
Active Contributor
0 Kudos

Hi Christian,

Your problem not much clear , Simplify If you used standard BAPI to update SAP transactional data, most of the time you have to place BAPI_TRANSACTION_COMMIT to commit.

If you need more information kindly look at the bellow blog.

https://blogs.sap.com/2013/01/24/commit-work-and-wait-does-not-work-as-expected-or-why-to-use-wait-u...

Regards,

Nawa

christian_kutsch
Explorer
0 Kudos

Example: A large number of BAPIs are called one after the other at the target system (process chain of BAPIs).

Not all of them require a BAPI_TRANSACTION_COMMIT - e.g. a read-only BAPI.

Nevertheless, a BAPI_TRANSACTION_COMMIT is made behind every BAPI.

Can these unnecessary BAPI commits create a problem while booking or locking.

p244500
Active Contributor
0 Kudos

Hi Christian Kutsch,

Answer to your question Its depend of the situation where you use commit function.

Ex: if you have 10 GL document to post using BAPI_ACC_DOCUMENT_POST , you can run this FM 10 time without committed . finally you need to committed to update database. then only it will update 10 document in database.

If you used BAPI_GOODSMVT_CREATE FM , each time you have to commited otherwise you can't proceed.

So for you if you think its necessary commit statement available , you can remove it.

If you have any issue with locked object follow the below link.

https://blogs.sap.com/2008/04/19/abap-pitfalls-part-1-lock-objects-and-commit-work/

Regards,

Nawa.