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.
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.
Step 3:
Add the messages to the application log at run time of the program.
Step 4:
Show messages as a popup or save for later reference.
Main program:
Top Include:
Forms:
create_log_object:
This will create and initialize the application log object.
select_data:
Depending on the result of the SQL, messages are added to application log.
add_single_msg:
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.
log:
Messages are saved for later reference if the application is running in the background, else the messages are displayed as a pop up.
save_log_db:
Save the log to database which can be displayed using SLG1.
show_log:
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.
If the program is run on foreground the application log will be shown as a popup below.
Enjoy!! :)
Thanks for sharing this Information,
ReplyDeleteGot to learn new things from your Blog on Sap abap.
http://thecreatingexperts.com/sap-abap-training-in-chennai/
Both online and classroom training is provided.
Contact 8122241286