‎2021 Jan 15 6:26 PM
I call a BAPI. If the return table contains an error message I immediately call BAPI_TRANSACTION_ROLLBACK. Otherwise, I attempt to perform an update to a custom table. If the custom table update fails I call BAPI_TRANSACTION_ROLLBACK.
If the custom table update is successful I call BAPI_TRANSACTION_COMMIT. I want the BAPI commit and table update to exist as a LUW. If the custom table update fails I want to rollback the BAPI. I'm wondering if the attempt to update the custom table will automatically commit the prior database changes associated with the BAPI call. Also, I'm assuming I would not need to call COMMIT WORK or ROLLBACK WORK.
‎2021 Jan 15 7:13 PM
I guess you mean you have this code?
CALL FUNCTION 'BAPI'.
UPDATE yourtable SET column = 1 WHERE key = ...
IF sy-subrc <> 0. " unique key constraint error
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ENDIF.If the BAPI updates tables via an update task, there can be theoretically a difference if the update task aborts, your table will be updated but not the tables updated by the BAPI. In that case, you should update your table in the update task to reduce the risk.