‎2019 Oct 17 11:53 AM
We call transaction BAPI_MATERIAL_MAINTAINDATA_RT to update material details. If there is no error we do a BAPI_TRANSACTION_COMMIT but when there is a error we do a BAPI_TRANSACTION_ROLLBACK.
In the return structure of the BAPI_MATERIAL_MAINTAINDATA_RT we get a error with application log number where we can find detailed information. But after the BAPI_TRANSACTION_ROLLBACK also the application log is deleted.
How can we rollback the MAINTAINDATA Bapi without removing the associated application log?
‎2019 Oct 17 12:01 PM
Hello Michael Kusters,
Can you Please let us know how you read the Application log details?
Is this related to Retrieving the messages for Application Log?
‎2019 Oct 17 12:56 PM
What I do not understand is, why do you need to keep a log of a cancelled action ?
to solve your issue, you "simply" have to create the log after the rollback
‎2019 Oct 17 4:23 PM
It's normal to keep the log of the execution of an interface, whatever it failed (interesting) or succeeded (less interesting).
call function 'BAPI_MATERIAL_MAINTAINDATA_RT' ...
IF return does not contain errors.
call function 'BAPI_TRANSACTION_COMMIT' ...
ELSE.
call function 'BAL_DB_LOAD' ... " read the log with application log number
call function 'BAPI_TRANSACTION_ROLLBACK'.
ENDIF.
‎2019 Oct 18 8:51 AM
Hi Michael,
You can always read the log data as sandra.rossi suggests using FM BAL_DB_LOAD and then execute error handling as you prefer.. You can directly message the enduser using the MESSAGE statement with the log details or by using exception classes, or setup you own log using tcodes slg0 & slg1.
Details on setting up your own log can also be found in this blog:
https://blogs.sap.com/2012/04/18/create-and-view-log-using-slg0-and-slg1-transaction/