Skip to Content
0
Former Member
Sep 11, 2007 at 11:54 AM

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

373 Views

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