‎2007 May 01 5:01 PM
Hi,
I get an Application log with 4 or 5 messages in it when i create an IDOC.
I would like to know in which tables are these messages stored or is there any
function module which can retrieve these messages.
The input which i have is the Application log number.
Pls. let me know and points will be definitely awarded.
Thanks.
‎2007 May 01 5:35 PM
Hi,
Ok...check this sample program..Give the application log number as input..You will see the corresponding texts..
PARAMETERS: p_aplog TYPE balognr.
DATA: s_logn TYPE bal_s_logn.
DATA: r_logn TYPE bal_r_logn.
DATA: s_lfil TYPE bal_s_lfil.
DATA: l_head TYPE balhdr_t.
DATA: t_logh TYPE bal_t_logh.
DATA: t_msgh TYPE bal_t_msgh.
START-OF-SELECTION.
s_logn-sign = 'I'.
s_logn-option = 'EQ'.
s_logn-low = p_aplog.
APPEND s_logn TO r_logn.
s_lfil-lognumber[] = r_logn[].
CALL FUNCTION 'BAL_DB_SEARCH'
EXPORTING
i_s_log_filter = s_lfil
IMPORTING
e_t_log_header = l_head
EXCEPTIONS
log_not_found = 1
no_filter_criteria = 2
OTHERS = 3.
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_LOAD'
EXPORTING
i_t_log_header = l_head
IMPORTING
e_t_log_handle = t_logh
e_t_msg_handle = t_msgh
EXCEPTIONS
no_logs_specified = 1
log_not_found = 2
log_already_loaded = 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.
DATA: s_msgh LIKE LINE OF t_msgh.
DATA: text(70).
LOOP AT t_msgh INTO s_msgh.
CALL FUNCTION 'BAL_LOG_MSG_READ'
EXPORTING
i_s_msg_handle = s_msgh
IMPORTING
e_txt_msg = text
EXCEPTIONS
log_not_found = 1
msg_not_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
ENDIF.
WRITE: / text.
ENDLOOP.
Thanks,
Naren
‎2007 May 01 5:10 PM
‎2007 May 01 5:13 PM
Hi Muthu,
I tried this FM but what should be the Log Handle and Message Num?
Thanks.
‎2007 May 01 5:35 PM
Hi,
Ok...check this sample program..Give the application log number as input..You will see the corresponding texts..
PARAMETERS: p_aplog TYPE balognr.
DATA: s_logn TYPE bal_s_logn.
DATA: r_logn TYPE bal_r_logn.
DATA: s_lfil TYPE bal_s_lfil.
DATA: l_head TYPE balhdr_t.
DATA: t_logh TYPE bal_t_logh.
DATA: t_msgh TYPE bal_t_msgh.
START-OF-SELECTION.
s_logn-sign = 'I'.
s_logn-option = 'EQ'.
s_logn-low = p_aplog.
APPEND s_logn TO r_logn.
s_lfil-lognumber[] = r_logn[].
CALL FUNCTION 'BAL_DB_SEARCH'
EXPORTING
i_s_log_filter = s_lfil
IMPORTING
e_t_log_header = l_head
EXCEPTIONS
log_not_found = 1
no_filter_criteria = 2
OTHERS = 3.
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_LOAD'
EXPORTING
i_t_log_header = l_head
IMPORTING
e_t_log_handle = t_logh
e_t_msg_handle = t_msgh
EXCEPTIONS
no_logs_specified = 1
log_not_found = 2
log_already_loaded = 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.
DATA: s_msgh LIKE LINE OF t_msgh.
DATA: text(70).
LOOP AT t_msgh INTO s_msgh.
CALL FUNCTION 'BAL_LOG_MSG_READ'
EXPORTING
i_s_msg_handle = s_msgh
IMPORTING
e_txt_msg = text
EXCEPTIONS
log_not_found = 1
msg_not_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
ENDIF.
WRITE: / text.
ENDLOOP.
Thanks,
Naren