SAP application log is a great method to display/save messages that occur when executing a SAP application. For custom applications, you can create your own application log object, which will enable user to see the log of the specific application in the future easily filtering using the object. Purpose of application log object is to logical segregation of messages.
With application log you can either save the messages in the system or show the messages as a popup to the user.
There are few important transactions when it comes to application log.
Create application log object – SLG0
Display application log – SLG1
I will be explaining how to create application log objects, how to append messages using ABAP coding and finally display or save the messages.
Go to transaction SLG0 and create application log main object and sub objects needed.
Create your own message class using SE91.
Add the messages to the application log at run time of the program.
Show messages as a popup or save for later reference.
This will create and initialize the application log object.
Depending on the result of the SQL, messages are added to application log.
Any number of messages can be added similarly as below. You have to specify the message class, message number, type (E, I, W) and the message variables.
Messages are saved for later reference if the application is running in the background, else the messages are displayed as a pop up.
Save the log to database which can be displayed using SLG1.
Log is shown as a pop up to the user. Setting the i_s_display_profile parameter enable you to show it as a popup.
if you run the program in the background you can check the log using SLG1. To view the log specify the log object. You can also specify other parameters such as date, time of execution, user name, program name if you need to check the past logs or narrow down the selection.
If the program is run on foreground the application log will be shown as a popup below.