Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BAPI_TRANSACTION_ROLLBACK Application log also deleted

MKusters
Explorer
0 Likes
2,086

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?

4 REPLIES 4
Read only

former_member1716
Active Contributor
0 Likes
1,753

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?

Read only

FredericGirod
Active Contributor
0 Likes
1,753

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

Read only

Sandra_Rossi
Active Contributor
1,753

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.
Read only

YorRombaut
Participant
0 Likes
1,753

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/