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

Regarding BAPI

Former Member
0 Likes
474

Hi ,

Which cases we need to use BAPI_TRANSACTION_COMMIT and BAPI_TRANSACTION_ROLLBACK

and also why we need to mension wait parameter in BAPI_TRANSACTION_COMMIT.

could you please advise me .

Regards ,

kiran

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
449

There could be multiple transactions that you might be performing in the function module and you may want that COMMIT should happen only when all the transactions are successful. So you write COMMIT at the end. If there is Error in any steps of update you can simply ROLLBACK hence ensuring atomicity i.e. (Save all or none) in the transaction.

Regards

Shital

3 REPLIES 3
Read only

Former Member
0 Likes
449

Hi kiran,

BAPI_TRASACTION_COMMIT:

we will use this for data base commit.

whenever if u change any data in SAP , to update the changes in database we have to use database commit.

similarly if u change any data in SAP using any BAPI we will use above BAPI for Commit.

BAPI_TRANSACTION_ROLLBACK

if u don't want to update the changes in database ,then to rollback the changes we will use

BAPI_TRANSACTION_ROLLBACK.

wait:

if u write wait means it will take some time and then it will update the database.

whenevr u r updating SAP in Loop we will use this wait parameter.

take an example of Purchane order.

whenver u r updating any P.O's in loop

P.O related tables get's locked for every update.

in this case if u use wait it will wait for some time and then it will update the database.

Thanks

Sai

Read only

Former Member
0 Likes
450

There could be multiple transactions that you might be performing in the function module and you may want that COMMIT should happen only when all the transactions are successful. So you write COMMIT at the end. If there is Error in any steps of update you can simply ROLLBACK hence ensuring atomicity i.e. (Save all or none) in the transaction.

Regards

Shital

Read only

Former Member
0 Likes
449

Hi,

In BAPI's some are auto committed and some are not auto committed. If look at the documentation of the bapi you can find that.

For the BAPI's which are not auto committed, we need to use the following FM.

BAPI_TRASACTION_COMMIT:

we will use this for data base commit.

if u change any data in SAP using any BAPI we will use above BAPI for Commit.

BAPI_TRANSACTION_ROLLBACK

if u don't want to update the changes in database ,then to rollback the changes we will use

BAPI_TRANSACTION_ROLLBACK.

Regards,

Venu