Function Writes an application log entry
Example s10applicationlog( "..." ).
Format data:
  mymsgtext type string,
  mymsgtype type string.

  s10applicationlog(
    exporting
      msgtext = mymsgtext
      msgtype = mymsgtype ).
Parameters
Name Type Description
msgtext string
Message text
msgtype string
Message type 'I'. 'W', 'E'
Description The s10applicationlog() method is used by the S10 framework to write entries to the "SAP Application Log" (displayed in transaction SLG1).

Instead of s10applicationlog(), it is better to use one of the more specialized methods s10loginfo(), s10logwarning() or s10logerror(), as this automatically adds information about the current class and HTML page to the application log.

Example:

    S10loginfo|Logonuser | && sy-uname ).
    S10logwarning
|Missing configuration parameter VKORG| ).
    S10logerror
|Logon terminated due to missing configuration parameters| ).

If the application log is enabled, the display in transaction SLG1 then looks like this::

 

The first entry "Call method LOGON" was inserted by the S10 framework (flow logging).


To switch on the logging you have two possibilities:

(1) In the ABAP program by the assignment

 s10session->applicationlog_level 2. Activates the application log of the desired level, here level 2.

(2) As user parameter /S10/LOG_LEVEL via transaction SU3.

Activates the application log level 3 as default for the user in question and for all applications of the S10 framework.

The levels have the following meaning:

0: No entry is made in the application log. This is the default value.
1: s10logerror() writes an entry to the application log
2: s10logwarning() and s10logerror() write entries to the application log
3: s10loginfo(), s10logwarning() and s10logerror() write entries to the application log

With s10logerror() the processing is aborted regardless of the log level. The user gets the abort message on his screen as well as information about the current method and the call stack:

We recomend that you normally leave the default level 0 switched on and activate one of the levels 1-3 for error tracing if necessary. Especially for testing an application one should set level 2 or 3 and evaluate the resulting messages.

The entries in the application log are made by default under the object "APPL_LOG", subobject "OTHERS", which you can select in transaction SLG1:

 

You can select another object in your application to better assign the entries. This is done with the statements (example values):

   s10session->applicationlog_object 'LPD'.
   s10session
->applicationlog_object 'CORR_INCONS'.

Select an existing object and subobject or create your own with transaction SLG0:

 

The entries of the application log are managed in the database tables BALDAT and BALHDR. Since numerous SAP programs write application logs, these tables can become very large. You can archive the entries in the SAP system (program BC_SBAL_WRI) and delete them online with transaction SLG2 or by scheduling a batch job.

Components S10 Framework