Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SLG1

Former Member
0 Likes
529

How can i create my own logs(as a result of checks performed inside my program) similar to the logs in SLG1 tcodes?? Or is it possible to have these errors logged in SLG1 itself?

1 ACCEPTED SOLUTION
Read only

former_member189779
Active Contributor
0 Likes
442

Yes, You can have these logs created in SLG1 itsself.

Example

          w_s_log-object    = 'YXXXXXX' Any name
        w_s_log-subobject = 'Y.......' Any name
        w_s_log-aldate    = sy-datum .
        w_s_log-altime    = sy-uzeit.
        w_s_log-aluser    = sy-uname.

        CALL FUNCTION 'BAL_LOG_CREATE'
          EXPORTING
            i_s_log      = w_s_log
          IMPORTING
            e_log_handle = w_log_handle.

   * Add message to log file
        CALL FUNCTION 'BAL_LOG_MSG_ADD'
          EXPORTING
            i_log_handle = w_log_handle
            i_s_msg      = w_s_msg.

          APPEND w_log_handle TO i_log.

        CALL FUNCTION 'BAL_DB_SAVE'
          EXPORTING
            i_t_log_handle = i_log.

          CALL FUNCTION 'BAL_LOG_REFRESH'
          EXPORTING
            i_log_handle = w_log_handle.

Data will be

    w_log_handle         TYPE balloghndl,
  w_s_log              TYPE bal_s_log,
  w_s_msg              TYPE bal_s_msg.

How can i create my own logs(as a result of checks performed inside my program) similar to the logs in SLG1 tcodes?? Or is it possible to have these errors logged in SLG1 itself?

1 REPLY 1
Read only

former_member189779
Active Contributor
0 Likes
443

Yes, You can have these logs created in SLG1 itsself.

Example

          w_s_log-object    = 'YXXXXXX' Any name
        w_s_log-subobject = 'Y.......' Any name
        w_s_log-aldate    = sy-datum .
        w_s_log-altime    = sy-uzeit.
        w_s_log-aluser    = sy-uname.

        CALL FUNCTION 'BAL_LOG_CREATE'
          EXPORTING
            i_s_log      = w_s_log
          IMPORTING
            e_log_handle = w_log_handle.

   * Add message to log file
        CALL FUNCTION 'BAL_LOG_MSG_ADD'
          EXPORTING
            i_log_handle = w_log_handle
            i_s_msg      = w_s_msg.

          APPEND w_log_handle TO i_log.

        CALL FUNCTION 'BAL_DB_SAVE'
          EXPORTING
            i_t_log_handle = i_log.

          CALL FUNCTION 'BAL_LOG_REFRESH'
          EXPORTING
            i_log_handle = w_log_handle.

Data will be

    w_log_handle         TYPE balloghndl,
  w_s_log              TYPE bal_s_log,
  w_s_msg              TYPE bal_s_msg.