标准日志存储

TCODE:

SLG1  

SLG2  

SLGD

    "&--创建句柄
    call function 'BAL_LOG_CREATE'
      exporting
        i_s_log                 = ls_mac_bal_log     "日志
      importing
        e_log_handle            = fv_loghd           "句柄
      exceptions
        log_header_inconsistent = 1
        others                  = 2.
    if sy-subrc <> 0.
      message id sy-msgid type sy-msgty number sy-msgno
              with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.

    ”&--新增日志
    call function 'BAL_LOG_MSG_ADD'
    exporting
      i_log_handle              =  fv_loghd         "创建日志时生成的日志句柄
      i_s_msg                   =  ls_bal_msg                 "日志返回信息
    exceptions
      log_not_found             = 1
      msg_inconsistent          = 2
      log_is_full               = 3
      others                    = 4
            .
  if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endif.

  "保存日志
  call function 'BAL_DB_SAVE'
    exporting
      i_client                   = sy-mandt
      i_save_all                 = 'X'
      i_t_log_handle             = lt_log_handle
    exceptions
      log_not_found              = 1
      save_not_allowed           = 2
      numbering_error            = 3
      others                     = 4
             .
  if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
          with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endif.

  "关闭日志
  "loop at ft_return assigning <fs_return>.
    call function 'BAL_LOG_REFRESH'
      exporting
        i_log_handle  = fv_loghd       "句柄
      exceptions
        log_not_found = 1
        others        = 2.
    if sy-subrc <> 0.
      message id sy-msgid type sy-msgty number sy-msgno
              with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.

 

posted on 2021-04-15 18:01  ricoo  阅读(127)  评论(0编辑  收藏  举报