SLG1 - ooxxvv/MySAPnotes GitHub Wiki
PageOutline {{{#!comment -------------------------------------------------- 以上的部份是固定的,不要變動 --- --------------------------------------------------------------------- 在建立連結時,請標明連結的頁面類型,例如:wiki:WikiStart,而不要只用 WikiStart --- }}}
SLG1
Features
{{{#!abap REPORT yapplog.
DATA: l_log_handle TYPE balloghndl, l_s_log TYPE bal_s_log, l_s_msg TYPE bal_s_msg.
START-OF-SELECTION. l_s_log-object = 'ZFI01'.
CALL FUNCTION 'BAL_LOG_CREATE' EXPORTING i_s_log = l_s_log IMPORTING e_log_handle = l_log_handle EXCEPTIONS OTHERS = 1.
CLEAR l_s_msg.
DO 3 TIMES. l_s_msg-msgty = 'E'. l_s_msg-msgid = 'ZX'. l_s_msg-msgno = '000'. l_s_msg-msgv1 = 'A'. l_s_msg-msgv2 = 'B'. l_s_msg-msgv3 = 'C'. l_s_msg-msgv4 = 'D'.
l_s_msg-probclass = 1.
CALL FUNCTION 'BAL_LOG_MSG_ADD'
EXPORTING
i_s_msg = l_s_msg
EXCEPTIONS
log_not_found = 0
OTHERS = 1.
ENDDO.
*-Show log PERFORM log_show.
*-Save logs CALL FUNCTION 'BAL_DB_SAVE' EXPORTING i_save_all = 'X' EXCEPTIONS OTHERS = 1.
&--------------------------------------------------------------------- *& Form log_show &---------------------------------------------------------------------
-
text
---------------------------------------------------------------------- FORM log_show. DATA: l_s_display_profile TYPE bal_s_prof.
*-Get display profile
- CALL FUNCTION 'BAL_DSP_PROFILE_STANDARD_GET' CALL FUNCTION 'BAL_DSP_PROFILE_NO_TREE_GET' IMPORTING e_s_display_profile = l_s_display_profile EXCEPTIONS OTHERS = 1. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF.
*-Use grid for display if wanted l_s_display_profile-use_grid = ''.
*-Set report to allow saving of variants l_s_display_profile-disvariant-report = sy-repid.
*--When you use also other ALV lists in your report, *--please specify a handle to distinguish between the display *--variants of these different lists, e.g: l_s_display_profile-disvariant-handle = 'LOG'.
*-Call display function module *--We do not specify any filter (like I_S_LOG_FILTER, ..., *--I_T_MSG_HANDLE) since we want to display all logs available CALL FUNCTION 'BAL_DSP_LOG_DISPLAY' EXPORTING i_s_display_profile = l_s_display_profile EXCEPTIONS OTHERS = 1.
IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF.
ENDFORM. "log_show }}}
{{{#!comment
TCODE
TABLE
FUNCTION, PROGRAM & CLASS
USER EXIST
}}}