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

Commit and rollback

Hello Friends,

I have one confusion!

Actually I am calling a few BAPI's to do some task, e.g, creating a SAP BP using a BAPI 'BAPI_BUPA_CREATE_FROM_DATA'. Now after creating a new SAP BP, I commit the newly created SAP Business Partner using the BAPI 'BAPI_TRANSACTION_COMMIT'.

I have a question, is it possible that after creating a SAP BP and before commiting the newly created data, I can use this check !

if sy-subrc eq 0.

and if this check is true the I only commit the new created SAP BP other wise roll back !!?

Need some suggestion upon this !

also pls do mention what is the BAPI to do rollback !

and rollback only be done when sy-subrc eq 4. or ??

Many thanks for your suggestions!


Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Posted on Dec 15, 2004 at 09:42 PM

    Normally all the BAPIs will give the messages back in the RETURN tables parameter. You need to read this internal table to see if there are any messages out there with message type 'E' or 'A'. If there are, then you have errors, otherwise your BAPI worked ok. If you use sy-subrc <> 0 after the BAPI call, it will not be correct.


    Message was edited by: Srinivas Adavi

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 16, 2004 at 06:33 PM

    Hi Marek,

    In most of the BAPIs a success is determined by whether a value is returned via the importing parameter of the call. In your case, if the 'Business Partner' parameter has a value other than the initial value, then you can assume your call is successful. In the return table itself, it may be as a message of type 'I'.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 16, 2004 at 07:26 PM

    Alternatively, after the call you can check

    if businesspartner is initial.

    *-- not successful, then read the return table for reason


    *-- successful


    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.