Вы находитесь на странице: 1из 3

REPORT zzz_mens_show. TABLES: t100.

DATA: g_log_handle g_s_log g_s_msg g_msgno TYPE TYPE TYPE TYPE balloghndl, bal_s_log, bal_s_msg, symsgno.

CONSTANTS: c_on(1) TYPE c VALUE 'X'. * Selection Screen SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001. PARAMETERS: p_sprsl LIKE t100-sprsl DEFAULT sy-langu OBLIGATORY, p_arbgb LIKE t100-arbgb OBLIGATORY, p_msgnr LIKE t100-msgnr OBLIGATORY. SELECTION-SCREEN END OF BLOCK b1. * At Selection Screen AT SELECTION-SCREEN. SELECT SINGLE * FROM t100 WHERE sprsl = p_sprsl AND arbgb = p_arbgb AND msgnr = p_msgnr. IF NOT sy-subrc IS INITIAL. MESSAGE e368(00) WITH 'Not Ok'. ENDIF. * Start of Selection START-OF-SELECTION. * create an initial log file g_s_log-extnumber = sy-title. CALL FUNCTION 'BAL_LOG_CREATE' EXPORTING i_s_log = g_s_log IMPORTING e_log_handle = g_log_handle 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. PERFORM add_message USING: 'A', 'E', 'W', 'S'. PERFORM log_show. *&---------------------------------------------------------------------* *& Form add_message *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM add_message USING f_msgty. g_s_msg-msgid = p_arbgb. g_s_msg-msgno = p_msgnr. g_s_msg-msgty = f_msgty.

* * * *

g_s_msg-msgv1 g_s_msg-msgv2 g_s_msg-msgv3 g_s_msg-msgv4

= = = =

'1'. '2'. '3'. '4'.

CASE f_msgty. WHEN 'A'. g_s_msg-probclass WHEN 'E'. g_s_msg-probclass WHEN 'W'. g_s_msg-probclass WHEN 'S'. g_s_msg-probclass ENDCASE. * * * *

= '1'. = '1'. = '2'. = '3'.

add message to log file (we explicitly specify I_LOG_HANLDE since we want to add this message to the new opened log. The default log might be different from this!). CALL FUNCTION 'BAL_LOG_MSG_ADD' EXPORTING i_log_handle = g_log_handle i_s_msg = g_s_msg EXCEPTIONS OTHERS = 1. CHECK sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDFORM. "add_message *-------------------------------------------------------------------* FORM log_show *-------------------------------------------------------------------FORM log_show. DATA: l_s_display_profile TYPE bal_s_prof. * get a prepared profile CALL FUNCTION 'BAL_DSP_PROFILE_POPUP_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 = c_on. * 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

Вам также может понравиться