ABAP based Application Log

By Vijayendra Krishnamurthy Rao, Hewlett-Packard

Steps to use ABAP Based Application Log.

This article explains briefly the standard logging processes with Application Log. It should help readers understand what Application Log is and how to use it.

What is Application Log?

Application Log provides an infrastructure for collecting messages and exceptions in a log, saving, reading and deleting logs in the database and displaying them.

Application Log provides multiple advantages:

  • System-wide uniform event logging

  • Accessible standardized UI based on ABAP List Viewer (ALV)

  • High capabilities for analysis of log data  

Application logging records the progress of the execution of an application. Whereas the system log records system events, you can use the application log to record application-specific events. Application Log is designed to temporarily store messages. Logs should be deleted in intervals (e.g. weekly batch job for deleting logs) to avoid too high database load.

A typical use of the Application Log is within delivery processing. Negative results of a dangerous goods check are written to the Application Log. Application messages and reactions are collected based on a customer defined examination schema (reactions determine how the document will be handled further). This approach increases the transparency of the process for end users. Messages are collected temporarily and are not saved to the database.

You may also use Application Log for complex scenarios such as the ticket selling by Internet invoked by a large number of users. With standard ABAP technologies (Enqueue/Dequeue) you can guarantee data consistency (details see below). 

 

How to use Application Log

There are different transactions for use of the Application Log.

·         Developer: Use transaction SLG0 to define entries for your own applications in the application log.

·         Key user: Use transaction SLG1 to analyze the application log.

·         Administrator: Use transaction SLG2 to delete logs.

 

Our Scenario:

Basically in our scenario we have two custom programs to load PO and GR’s from a flat file into SAP. We wanted a mechanism to store the results of each program run in the database for future use. One way of achieving this is to create Z custom tables and store all the errors in the Z table. The other option was to use the std sap application log mechanism provided by SAP.  

We chose the second option as it is more robust and SAP has provided std transactions to display the log. So we don’t have to write another program to display the log from the Z tables had we used the first option.  

Step 1à Create Custom Application log objects

Go to transaction SLG1.Go to change mode and click on New entries button on the application tool bar.  

 

Enter the name of the objects. In our case we have entered two objects. One to store application log for Good receipts and one for storing application log for Purchase orders.  

You can also create Sub-objects for an object. Subobjects are simply further classifications of the application log. In our case we don’t need a sub object. But the following screen shots below shows some of the std objects and their sub-objects.  

As seen above for the standard object ALE DISTRIBUTION UNIT there are 2 sub objects

  1. Inbound and

  2. Outbound.  

So if there is any application logs generated during inbound ALE processing it will be stored in the INBOUND sub-object and if there is any application logs generated during outbound processing then it will be stored in the OUTBOUND sub-object. This is just to classify the logs while storing them in the database. Instead of simply creating the logs and storing them it makes sense to have sub objects and store respective application logs. This way it becomes easy for trouble shooting in the future.  

Lets see other standard objects and their sub-objects.  

 

In the standard application log object IUFC – Form Printout: Form Class Maintenance the sub-objects are created to store the type of logs generated while processing. So in this case as seen from the screen shot above there are sub-objects such as

  1. ERRORS

  2. SUCCESS

  3. WARNINGS

And so on… so the purpose of the sub-object is to simply classify the types of application logs generated while processing any applications.  

So once the entries are made in SLG0 transaction, save your entries. The system will prompt for creating a transport request. Create a transport request so that these objects can be transported from Development to the quality and finally to the production systems.  

Important point to remember.

Once you save the entries in the system and create a transport request the system will automatically generate 2 LOCK function modules. If you go to SE09 and expand the TP number you will see the system has created two LOCK function modules. 

Click here to continue...

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image