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: 

Calling BAPI_TRANSACTION_COMMIT after a BAPI called failed

Former Member
0 Kudos

Good day,

If i call BUPA_INBOUND_MAIN_SAVE and it fails for some reason, i.e. there are Errors or Aborts in the return parameter and i then call BAPI_TRANSACTION_COMMIT will the locks on the record be released?

Does a user need to explicitly call RollBack if there was an error and Commit if there was no errors?

Thanks

I Will give points, promise!!!!

Marc

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Marc,

You could check the return parameter and call commit Bapi only if the BUPA_INBOUND_MAIN_SAVE returns 0.

If there is an error or abort data will not be updated in the database.

6 REPLIES 6

Former Member
0 Kudos

You should not need to call the BAPI_TRANSACTION_COMMIT if the bapi call was unsuccessful. All locks should be released by the bapi itself.

Sudha

Former Member
0 Kudos

Hi,

If there were any errors during a BAPI call its safe to call BAPI_TRANSACTION_ROLLBACK. You SHOULD NOT call the COMMIT bapi if there were any errors.

-Kiran

Former Member
0 Kudos

BAPI_TRANSACTION_COMMIT is used to commit the transaction and should not be called if there is an error.

You need not perform rollback if there are errors but you do need to use an explicit COMMIT or BAPI_TRANSACTION_COMMIT if there is no error to be sure of the transaction being comitted.

Former Member
0 Kudos

Hi Marc,

You could check the return parameter and call commit Bapi only if the BUPA_INBOUND_MAIN_SAVE returns 0.

If there is an error or abort data will not be updated in the database.

0 Kudos

Thanks for all the replies.

The problem i have is that I call a Function Module (someone else wrote),

Their logic is:

BUPA_INBOUND_MAIN_SAVE

BAPI_TRANSACTION_COMMIT (Does not care if an error occured or not)

If an error occured during BUPA_INBOUND_MAIN_SAVE the partner is locked and no one else can edit the partner except my session.

If i ask him to put a rollback will this release the lock on the business partner?

0 Kudos

Yes, Rollback shoulr release the lock on the business partner. But if you are going to ask him to add a roll back, you might as well ask him to commit only if there is no error.

This way you dont have to rollback on error.