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

Can i use BAPI_COMMIT/BAPI_ROLLBACK to commit/rollback more BAPI actions?

Former Member
0 Likes
876

Hi to all,

may i use BAPI_TRANSACTION_COMMIT to commit two BAPIs or BAPI_TRANSACTION_ROLLBACK to rollback two BAPIs?

Pratical example.

I call BAPI_OUTB_DELIVERY_CHANGE to delete a delivery.

After i have to call BAPI_PO_CHANGE to change a transfer order.

(The example uses the real BAPI i'll have to use in my code).

I need that if the second BAPI goes wrong (there are error messages) the first one (and the second) should be rolled-back.

Code-example.


call function 'BAPI_OUTB_DELIVERY_CHANGE'
 exporting .....

...other code lines ....


call function 'BAPI_PO_CHANGE'
 exporting .....

if sy-subrc eq 0. "means return_tab contains no errors
 call function 'BAPI_TRANSACTION_COMMIT'.
else.
 call function 'BAPI_TRANSACTION_ROLLBACK'.
endif.

This code will work, or the rollback will reset only the second bapi db-actions (means that cannot rollback the delivery delete)?

Thx a lot

Andrea

1 REPLY 1
Read only

Former Member
0 Likes
383

AFAIK, BAPI_COMMIT or BAPI_ROLLBACK will work for the last executed BAPI...So you better consider put one call per BAPI...

Greetings,

Blag.