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

BAPI_TRANSACTION_COMMIT & BAPI_TRANSACTION_ROLLBACK

Former Member
0 Likes
993

Hi Gurus,

Lets say I am uploading fixed assets data using BAPI_FIXEDASSET_CREATE from excel file. There are many assets to be uploaded.

I use this as the logic.

Loop at table ( table contains all the fixed assets data )

      • Logic follows here to populate data for one fixed asset ***

Call BAPI_FIXEDASSET_CREATE

if error message.

BAPI_TRANSACTION_ROLLBACK.

add error message to output report.

elseif success message.

add success message to output report.

endif.

endloop.

call bapi_transaction_commit with wait = X.

*****************************************************************************************

My queries:

1. Can BAPI_TRANSACTION_COMMIT commit all the successful created assets simultaneously?

2. Is it advisable to perform BAPI_TRANSACTION_COMMIT after each successfull BAPI_FIXEDASSET_CREATE or the above logic would work fine? If any record fails during commit I need to know which one failed.

3. Will performing BAPI_TRANSACTION_COMMIT after each successfull BAPI_FIXEDASSET_CREATE slow down the process when compared to commiting all successful records simultaneously

1 ACCEPTED SOLUTION
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
564

Hi,

If any record fails during commit I need to know which one failed

In this case you have to commit each bapi call and make use of the return parameter of BAPI_TRANSACTION_COMMIT, for this you have to pass wait = X becasue when sy-subrc is 4 after a synchronous call then it implies error.

In your case you can do this,

Call your bapi with required data, check if the call is successfull and then can call commit with wait.

Commit work - Asynchronous

Commit work with wait - Synchronous

All your questions can be cleared by yourself by reading SAP help documentation on Logical unit of Work.

Regards

Kesav

1 REPLY 1
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
565

Hi,

If any record fails during commit I need to know which one failed

In this case you have to commit each bapi call and make use of the return parameter of BAPI_TRANSACTION_COMMIT, for this you have to pass wait = X becasue when sy-subrc is 4 after a synchronous call then it implies error.

In your case you can do this,

Call your bapi with required data, check if the call is successfull and then can call commit with wait.

Commit work - Asynchronous

Commit work with wait - Synchronous

All your questions can be cleared by yourself by reading SAP help documentation on Logical unit of Work.

Regards

Kesav