Ниже описан код формы, которая читает сообщения из системного журнала приложений
FORM log_test USING begda TYPE sydatum endda TYPE sydatum. FORMAT COLOR COL_BACKGROUND. DATA: bal_t_msgh TYPE bal_t_msgh, balhdr_t TYPE balhdr_t, bal_s_msg TYPE bal_s_msg , balmsghndl TYPE balmsghndl, text TYPE text200.
DATA: wa_balhdr LIKE balhdr. TYPES: BEGIN OF t_message , icon TYPE iconname , text TYPE text200 , END OF t_message. TYPES: t_mes TYPE TABLE OF t_message. DATA: wa_mes TYPE t_message. DATA: BEGIN OF jornal OCCURS 2 , messages TYPE t_mes , END OF jornal. CLEAR jornal. REFRESH jornal. DATA: it_balhdr LIKE balhdr OCCURS 1 WITH HEADER LINE. SELECT * FROM balhdr INTO wa_balhdr WHERE aldate BETWEEN begda AND endda AND object EQ 'IUCSPROD'. REFRESH balhdr_t. APPEND wa_balhdr TO balhdr_t. CLEAR bal_t_msgh. REFRESH bal_t_msgh. CALL FUNCTION 'BAL_DB_LOAD' EXPORTING i_t_log_header = balhdr_t IMPORTING e_t_msg_handle = bal_t_msgh. REFRESH jornal-messages. LOOP AT bal_t_msgh INTO balmsghndl. CALL FUNCTION 'BAL_LOG_MSG_READ' EXPORTING i_s_msg_handle = balmsghndl IMPORTING e_s_msg = bal_s_msg e_txt_msg = text. CLEAR wa_mes. IF bal_s_msg-msgty EQ 'A'. wa_mes-icon = '@8N@'. ELSE. wa_mes-icon = '@5B@'. ENDIF. wa_mes-text = text. APPEND wa_mes TO jornal-messages. ENDLOOP. APPEND jornal. ENDSELECT. LOOP AT jornal. LOOP AT jornal-messages INTO wa_mes. WRITE: / wa_mes-icon, wa_mes-text. ENDLOOP. WRITE: /. ENDLOOP. ENDFORM. " LOG_TEST
Комментарии
Отправить комментарий