Message log ABAP SAP

Often there is a need to display a list of messages to a SAP user. The ABAP message log can display information about the progress of the SAP program. It is also necessary to display a list of errors that occurred as a result of its execution. As a result, we will analyze a set of FMs intended for displaying the ABAP message log.

Implementations are a global variable in an ABAP program or an attribute of a class. And in the course of program execution, messages are stored in this variable. At the end of the program execution, a log of messages is displayed. Or the log is stored in the SAP system and can be viewed in transaction SLG1.

Stages of working with the SAP message log.

Creating an message log ABAP SAP.

The SAP message log instance is created using the function module BAL_LOG_CREATE.

Adding messages to the SAP log.

You can add new messages to the log using the BAL_LOG_MSG_ADD function module.

Displaying the ABAP message log on the screen.

To display the ABAP message log on the screen as a pop-up window, use the BAL_DSP_LOG_DISPLAY FM.

Deletion of the ABAP message log from memory.

The BAL_LOG_REFRESH FM is used to remove the ABAP message log from memory. By the message log identifier i_log_handle, it finds the log and removes it from memory.

ABAP message log output template:

Ready. As a result, we get a message log on the screen. And each line has an indicator depending on the type of message with text. It is also possible to view the details of each message. You can use the option without a global variable. For example, we can immediately create an ABAP message object and save the messages directly to the log. This is suitable for background execution. Also, the need for a global variable is affected by the need for a complete list of messages at the end of execution.

Also many interesting examples can be found in SBAL_DEMO*.

Leave a Reply