Skip to Content
author's profile photo Former Member
Former Member

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

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Sep 11, 2007 at 10:26 PM

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

    Greetings,

    Blag.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.