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!
Marek
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.
BAPI to do rollback BAPI_TRANSACTION_ROLLBACK.
Message was edited by: Srinivas Adavi
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'.
Alternatively, after the call you can check
if businesspartner is initial.
*-- not successful, then read the return table for reason
else.
*-- successful
endif.
Add a comment