Sei sulla pagina 1di 38

*&---------------------------------------------------------------------* *& Report ZSXMB_MONI_VIEWER *&---------------------------------------------------------------------* REPORT zsxmb_moni_viewer. TYPE-POOLS: abap, slis, sdydo, ixml.

TYPES: BEGIN OF ty_zsxmb_moni, msgguid TYPE sxmsmsglst-msgguid, pid TYPE sxmsmsglst-pid, ob_system TYPE sxmsmsglst-ob_system, ob_ns TYPE sxmsmsglst-ob_ns, ob_name TYPE sxmsmsglst-ob_name, ib_system TYPE sxmsmsglst-ib_system, ib_ns TYPE sxmsmsglst-ib_ns, ib_name TYPE sxmsmsglst-ib_name, msgtype TYPE sxmsmsglst-msgtype, msgstate TYPE sxmsmsglst-msgstate, exetimest TYPE sxmsmsglst-exetimest, inittimest TYPE sxmsmsglst-inittimest, sendtimest TYPE sxmsmsglst-sendtimest, adminuser TYPE sxmsmsglst-adminuser, ref_to_msg TYPE sxmsmsglst-ref_to_msg, rest_vers TYPE sxmsmsglst-rest_vers, vers TYPE SXMSMSGLST-vers, rec_count TYPE i, * msg_cnt TYPE i, END OF ty_zsxmb_moni. DATA: gt_int_structure TYPE STANDARD TABLE OF zint_master. "#EC NEEDED TYPES : BEGIN OF ty_zsxmb_moni_output1, ob_system TYPE ait_sndr, ob_ns TYPE zrm_oifns, ob_name TYPE zrm_oifname, ib_system TYPE ait_rcvr, ib_ns TYPE zrm_iifns, ib_name TYPE zrm_iifname, error TYPE int4, scheduled TYPE int4, success TYPE int4, cancelled TYPE int4, END OF ty_zsxmb_moni_output1. DATA: gt_firstlist TYPE TABLE OF zsxmb_moni_1stlist. *data declaration for system error text TYPES: BEGIN OF ty_syst_ertxt, msgguid TYPE sxmsmguid, errcat TYPE sxmserrcat, errcode TYPE sxmserrid, errtxt TYPE sxmserrtxt, END OF ty_syst_ertxt. DATA: gt_syst_ertxt TYPE STANDARD TABLE OF ty_syst_ertxt. TYPES: BEGIN OF ty_msgid, msgguid TYPE sxmsmguid, errormsg TYPE string, END OF ty_msgid.

"#EC NEEDED

DATA: gt_msgid TYPE STANDARD TABLE OF ty_msgid. TYPES : BEGIN OF ty_idtab, msgguid TYPE sxmsmguid, pid TYPE sxmspid, rest_vers TYPE sxmslsqnbr, vers TYPE sxmspmast-vers, errormsg TYPE string, END OF ty_idtab. DATA :gt_idtab TYPE TABLE OF ty_idtab, gwa_idtab TYPE ty_idtab, gt_idtab1 TYPE TABLE OF ty_idtab. TYPES:BEGIN OF ty_field_desc, zinterface TYPE char45, zfield_name TYPE zname, zfield_desc TYPE zdes, END OF ty_field_desc.

"#EC NEEDED

"#EC NEEDED "#EC NEEDED "#EC NEEDED

DATA: gt_field_desc TYPE STANDARD TABLE OF ty_field_desc, "#EC NEEDED gwa_field_desc TYPE ty_field_desc. "#EC NEEDED DATA: gt_zsxmb_moni TYPE STANDARD TABLE OF ty_zsxmb_moni, "#EC NEEDED gt_output TYPE STANDARD TABLE OF ty_zsxmb_moni, "#EC NEEDED gt_main TYPE STANDARD TABLE OF ty_zsxmb_moni_output1,"TYPE TABLE OF zsxm b_moni_output1, "#EC NEEDED gv_error TYPE c LENGTH 1, "#EC NEEDED gv_index TYPE sy-tabix, "#EC NEEDED gv_flag1 TYPE char1, "#EC NEEDED gv_flag2 TYPE char1, "#EC NEEDED gv_flag3 TYPE char1, "#EC NEEDED gv_flag4 TYPE char1, "#EC NEEDED gv_intname TYPE sxmsmsglst-ob_name, "#EC NEEDED gv_int TYPE zint_master-zinterface. "#EC NEEDED DATA: gt_msgstate_err TYPE RANGE gwa_msgstate_err LIKE LINE gt_msgstate_suc TYPE RANGE gwa_msgstate_suc LIKE LINE gt_msgstate_sch TYPE RANGE gwa_msgstate_sch LIKE LINE gt_msgstate_can TYPE RANGE gwa_msgstate_can LIKE LINE CONSTANTS: gc_bar TYPE c LENGTH 1 BEGIN OF gc_log, error TYPE symsgty success TYPE symsgty warning TYPE symsgty END OF gc_log. OF OF OF OF OF OF OF OF sxmspmstat, gt_msgstate_err, sxmspmstat, gt_msgstate_suc, sxmspmstat, gt_msgstate_sch, sxmspmstat, gt_msgstate_can. "#EC "#EC "#EC "#EC "#EC "#EC "#EC "#EC NEEDED NEEDED NEEDED NEEDED NEEDED NEEDED NEEDED NEEDED

VALUE '/', VALUE 'E', VALUE 'S', VALUE 'W',

SELECTION-SCREEN BEGIN OF BLOCK bl01 WITH FRAME TITLE text-t01 . SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT (29) text-c01 FOR FIELD p_exedat. PARAMETERS p_exedat TYPE dats OBLIGATORY. SELECTION-SCREEN COMMENT 44(2) co_bar FOR FIELD p_exetim. PARAMETERS p_exetim TYPE tims OBLIGATORY. "#EC SEL_WRONG SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT (29) text-c02 FOR FIELD p_exe2da. PARAMETERS p_exe2da TYPE dats OBLIGATORY. SELECTION-SCREEN COMMENT 44(2) co_bar1 FOR FIELD p_exe2ti. PARAMETERS p_exe2ti TYPE tims OBLIGATORY. "#EC SEL_WRONG SELECTION-SCREEN END OF LINE. SELECTION-SCREEN END OF BLOCK bl01. *For interface SELECTION-SCREEN BEGIN OF BLOCK bl02 WITH FRAME TITLE text-t02 . SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT (29) text-c03 FOR FIELD s_int. SELECT-OPTIONS : s_int FOR gv_intname . SELECTION-SCREEN END OF LINE. SELECTION-SCREEN END OF BLOCK bl02. SELECTION-SCREEN BEGIN OF BLOCK b103 WITH FRAME TITLE text-t03. SELECTION-SCREEN BEGIN OF LINE . SELECTION-SCREEN POSITION 5. PARAMETERS: rb_msg RADIOBUTTON GROUP r1 DEFAULT 'X'. *selection-screen position 12. SELECTION-SCREEN COMMENT (25) text-t04 FOR FIELD rb_msg. SELECTION-SCREEN POSITION 55. PARAMETERS: rb_rec RADIOBUTTON GROUP r1. SELECTION-SCREEN COMMENT (25) text-t05 FOR FIELD rb_rec. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN END OF BLOCK b103 . INITIALIZATION. co_bar = gc_bar. co_bar1 = gc_bar. p_exedat = sy-datum. p_exe2da = sy-datum + 1. PERFORM prepare_msgstate_ranges. *F4 Help for interface name AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_int-low. gv_int = s_int-low. PERFORM select_interface_name USING gv_int. AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_int-high. gv_int = s_int-high. PERFORM select_interface_name USING gv_int. AT SELECTION-SCREEN ON s_int. PERFORM validate_interface. START-OF-SELECTION. PERFORM validate_date. IF gv_error IS INITIAL. PERFORM main. ENDIF. *&---------------------------------------------------------------------* *& Form validate_date *&---------------------------------------------------------------------* FORM validate_date. DATA: lv_exedat TYPE timestampl, lv_exe2dat TYPE timestampl.

CLEAR :lv_exedat,lv_exe2dat. CONVERT: DATE p_exedat TIME p_exetim INTO TIME STAMP lv_exedat TIME ZONE sy-zonlo, DATE p_exe2da TIME p_exe2ti INTO TIME STAMP lv_exe2dat TIME ZONE sy-zonlo. IF lv_exedat >= lv_exe2dat. MESSAGE i055(xms_adm) DISPLAY LIKE gc_log-error. gv_error = '1'. ENDIF. ENDFORM. "validate_date *&---------------------------------------------------------------------* *& Form main *&---------------------------------------------------------------------* FORM main. DATA: lt_fieldcat TYPE slis_t_fieldcat_alv, lt_sort TYPE slis_t_sortinfo_alv, lt_excluding TYPE slis_t_extab, lwa_layout TYPE slis_layout_alv. PERFORM message_log_data_selection. PERFORM select_data. IF gt_zsxmb_moni IS NOT INITIAL. PERFORM process_data. PERFORM prepare_field_catalog CHANGING lt_fieldcat. PERFORM prepare_pf_status CHANGING lt_excluding. PERFORM prepare_layout CHANGING lwa_layout. PERFORM show_alv_grid USING lt_fieldcat lt_sort lt_excluding lwa_layout. ENDIF. ENDFORM. "main *&---------------------------------------------------------------------* *& Form select_data *&---------------------------------------------------------------------* FORM select_data. DATA: lv_exedat TYPE timestampl, "#EC NEEDED lv_exe2dat TYPE timestampl. "#EC NEEDED CONVERT: DATE p_exedat TIME p_exetim INTO TIME STAMP lv_exedat TIME ZONE sy-zonlo, DATE p_exe2da TIME p_exe2ti INTO TIME STAMP lv_exe2dat TIME ZONE sy-zonlo. IF gt_zsxmb_moni[] IS NOT INITIAL. SELECT * FROM zint_master INTO CORRESPONDING FIELDS OF TABLE gt_int_structure WHERE zinterface IN s_int. IF sy-subrc EQ 0. SELECT zinterface zfield_name zfield_desc FROM zfield_descr INTO CORRESPONDING FIELDS OF TABLE gt_field_desc FOR ALL ENTRIES IN gt_int_structure WHERE zinterface = gt_int_structure-zinterface. ENDIF. ENDIF. *for payload

IF gt_zsxmb_moni[] IS NOT INITIAL. SELECT msgguid pid rest_vers FROM sxmspmast INTO TABLE gt_idtab FOR ALL ENTRIES IN gt_zsxmb_moni WHERE msgguid = gt_zsxmb_moni-msgguid. ELSEIF gt_zsxmb_moni IS INITIAL. MESSAGE i007(sabapdocu) DISPLAY LIKE gc_log-error. ENDIF. * To get System Error text msg IF gt_zsxmb_moni[] IS NOT INITIAL. SELECT msgguid errcat errcode errtxt FROM sxmsperror INTO CORRESPONDING FIELDS OF TABLE gt_syst_ertxt FOR ALL ENTRIES IN gt_zsxmb_moni WHERE msgguid = gt_zsxmb_moni-msgguid. ELSEIF gt_zsxmb_moni IS INITIAL. MESSAGE i007(sabapdocu) DISPLAY LIKE gc_log-error. ENDIF.

"#EC NEEDED

ENDFORM. "select_data *&---------------------------------------------------------------------* *& Form process_data *&---------------------------------------------------------------------* FORM process_data. CONSTANTS lc_1 TYPE char1 VALUE '1'. "#EC NEEDED DATA: lr_zsxmb_moni TYPE REF TO ty_zsxmb_moni, lwa_output LIKE LINE OF gt_output, lwa_main LIKE LINE OF gt_main, lwa_int_structure LIKE LINE OF gt_int_structure, "#EC NEEDED lwa_firstlist LIKE LINE OF gt_firstlist."TYPE ty_firstlist. CLEAR :gt_output,lr_zsxmb_moni. LOOP AT gt_zsxmb_moni REFERENCE INTO lr_zsxmb_moni. CLEAR lwa_output. lwa_output-msgguid = lr_zsxmb_moni->msgguid. lwa_output-pid = lr_zsxmb_moni->pid. lwa_output-ob_system = lr_zsxmb_moni->ob_system. lwa_output-ob_ns = lr_zsxmb_moni->ob_ns. lwa_output-ob_name = lr_zsxmb_moni->ob_name. lwa_output-ib_system = lr_zsxmb_moni->ib_system. lwa_output-ib_ns = lr_zsxmb_moni->ib_ns. lwa_output-ib_name = lr_zsxmb_moni->ib_name. lwa_output-msgstate = lr_zsxmb_moni->msgstate. lwa_output-msgtype = lr_zsxmb_moni->msgtype. IF rb_rec IS NOT INITIAL. PERFORM f_get_rec_count USING lwa_output-msgguid lwa_output-pid lr_zsxmb_moni->rest_vers CHANGING lwa_output-rec_count. ELSE. lwa_output-rec_count = 1. ENDIF. COLLECT lwa_output INTO gt_output. CLEAR lwa_output.

ENDLOOP. SORT gt_output BY msgguid. CLEAR :lwa_output, lwa_int_structure. DATA :lv_tabix TYPE sy-tabix. **Synchronous grouping LOOP AT gt_output INTO lwa_output. lv_tabix = sy-tabix. IF lwa_output-msgtype = 'S'. READ TABLE gt_int_structure INTO lwa_int_structure WITH KEY zinterface = lwa_output-ob_name. "#EC WARNOK IF sy-subrc EQ 0. lwa_output-ib_system = lwa_int_structure-zreceiver. *Modify table with receiver updated MODIFY gt_output INDEX lv_tabix FROM lwa_output TRANSPORTING ib_system. *Delete response message(for synchronous messages) DELETE gt_output WHERE msgtype = 'S' AND ob_system = lwa_output-ib_system AND ob_name = lwa_output-ib_name. ENDIF. ENDIF. CLEAR: lwa_int_structure,lwa_output. ENDLOOP. *To count number of error,scheduled,success and cancelled. LOOP AT gt_output INTO lwa_output. CASE lwa_output-msgstate. WHEN '014' OR '017' OR '018' OR '023' OR '024' OR '025' OR '111' OR '114' OR '117'. * lwa_main-error = lc_1. lwa_main-error = lwa_output-rec_count. WHEN '001' OR '002'. lwa_main-scheduled = lwa_output-rec_count. WHEN '003' OR '103'. lwa_main-success = lwa_output-rec_count. WHEN '020' OR '021'. lwa_main-cancelled = lwa_output-rec_count. ENDCASE. lwa_main-ob_system = lwa_output-ob_system. lwa_main-ob_ns = lwa_output-ob_ns. lwa_main-ob_name = lwa_output-ob_name. lwa_main-ib_system = lwa_output-ib_system. lwa_main-ib_ns = lwa_output-ib_ns. lwa_main-ib_name = lwa_output-ib_name. COLLECT lwa_main INTO gt_main. CLEAR lwa_main. ENDLOOP. *Display only one interface name and namespace CLEAR lwa_main. * break dikumar. LOOP AT gt_main INTO lwa_main. lwa_firstlist-ob_system = lwa_main-ob_system. lwa_firstlist-ib_system = lwa_main-ib_system. lwa_firstlist-error = lwa_main-error. lwa_firstlist-scheduled = lwa_main-scheduled . lwa_firstlist-success = lwa_main-success . lwa_firstlist-cancelled = lwa_main-cancelled. IF lwa_main-ob_name IS NOT INITIAL. lwa_firstlist-intr_ns = lwa_main-ob_ns.

lwa_firstlist-intr_name = lwa_main-ob_name. READ TABLE gt_int_structure INTO lwa_int_structure WITH KEY zinterface = lwa_main-ob_name. "#EC WARNOK IF sy-subrc EQ 0. lwa_firstlist-zdesc = lwa_int_structure-zdesc. lwa_firstlist-ob_system_name = lwa_int_structure-zsender_desc. lwa_firstlist-ib_system_name = lwa_int_structure-zreceiver_desc. ENDIF. ELSEIF lwa_main-ib_name IS NOT INITIAL. lwa_firstlist-intr_ns = lwa_main-ib_ns. lwa_firstlist-intr_name = lwa_main-ib_name. READ TABLE gt_int_structure INTO lwa_int_structure WITH KEY zinterface = lwa_main-ib_name. "#EC WARNOK IF sy-subrc EQ 0. lwa_firstlist-zdesc = lwa_int_structure-zdesc. lwa_firstlist-ob_system_name = lwa_int_structure-zsender_desc. lwa_firstlist-ib_system_name = lwa_int_structure-zreceiver_desc. ENDIF. ENDIF. APPEND lwa_firstlist TO gt_firstlist. ENDLOOP. ENDFORM. "process_data *&---------------------------------------------------------------------* *& Form prepare_field_catalog *&---------------------------------------------------------------------* FORM prepare_field_catalog CHANGING ct_fieldcat TYPE slis_t_fieldcat_alv. CONSTANTS: lc_structure TYPE dd02l-tabname VALUE 'ZSXMB_MONI_1STLIST', BEGIN OF lc_fieldname, error TYPE slis_fieldcat_alv-fieldname VALUE 'ERROR', scheduled TYPE slis_fieldcat_alv-fieldname VALUE 'SCHEDULED', success TYPE slis_fieldcat_alv-fieldname VALUE 'SUCCESS', cancelled TYPE slis_fieldcat_alv-fieldname VALUE 'CANCELLED', pid TYPE slis_fieldcat_alv-fieldname VALUE 'PID', msgdate TYPE slis_fieldcat_alv-fieldname VALUE 'MSGDATE', msgtime TYPE slis_fieldcat_alv-fieldname VALUE 'MSGTIME', END OF lc_fieldname. DATA lr_fieldcat TYPE REF TO slis_fieldcat_alv. CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE' EXPORTING i_structure_name = lc_structure CHANGING ct_fieldcat = ct_fieldcat EXCEPTIONS inconsistent_interface = 1 program_error = 2 OTHERS = 3. IF sy-subrc <> 0. ENDIF. * break dikumar. LOOP AT ct_fieldcat REFERENCE INTO lr_fieldcat. CASE lr_fieldcat->fieldname. WHEN lc_fieldname-error. lr_fieldcat->reptext_ddic = 'Error'(h03). lr_fieldcat->hotspot = abap_true.

"#EC NEEDED

WHEN lc_fieldname-scheduled. lr_fieldcat->reptext_ddic = 'Scheduled'(h04). lr_fieldcat->hotspot = abap_true. WHEN lc_fieldname-success. lr_fieldcat->reptext_ddic = 'Success'(h05). lr_fieldcat->hotspot = abap_true. WHEN lc_fieldname-cancelled. lr_fieldcat->reptext_ddic = 'Cancelled'(h06). lr_fieldcat->hotspot = abap_true. WHEN lc_fieldname-pid. lr_fieldcat->no_out = abap_true. WHEN lc_fieldname-msgdate. lr_fieldcat->reptext_ddic = 'Execution Date'(h01). WHEN lc_fieldname-msgtime. lr_fieldcat->reptext_ddic = 'Execution Time'(h02). WHEN 'INTR_NS' OR 'INTR_NAME'. lr_fieldcat->no_out = abap_true. WHEN 'OB_SYSTEM' OR 'IB_SYSTEM'. lr_fieldcat->no_out = abap_true. WHEN 'IB_SYSTEM_NAME'. lr_fieldcat->seltext_s = 'Receiver Name'. lr_fieldcat->seltext_m = 'Receiver Name'. lr_fieldcat->seltext_l = 'Receiver Name'. WHEN 'OB_SYSTEM_NAME'. lr_fieldcat->seltext_s = 'Sender Name'. lr_fieldcat->seltext_m = 'Sender Name'. lr_fieldcat->seltext_l = 'Sender Name'. ENDCASE. ENDLOOP. ENDFORM. "prepare_field_catalog *&---------------------------------------------------------------------* *& Form prepare_pf_status *&---------------------------------------------------------------------* FORM prepare_pf_status CHANGING ct_excluding TYPE slis_t_extab. CONSTANTS: BEGIN OF lc_excluding, total TYPE slis_extab-fcode VALUE '&UMC', preview TYPE slis_extab-fcode VALUE '&RNT_PREV', excel TYPE slis_extab-fcode VALUE '&VEXCEL', text TYPE slis_extab-fcode VALUE '&AQW', local TYPE slis_extab-fcode VALUE '%PC', mail TYPE slis_extab-fcode VALUE '%SL', graph TYPE slis_extab-fcode VALUE '&GRAPH', layout TYPE slis_extab-fcode VALUE '&OL0', info TYPE slis_extab-fcode VALUE '&INFO', END OF lc_excluding. DATA lwa_excluding LIKE LINE OF ct_excluding. lwa_excluding-fcode = lc_excluding-preview. APPEND lwa_excluding TO ct_excluding. lwa_excluding-fcode = lc_excluding-text. APPEND lwa_excluding TO ct_excluding. lwa_excluding-fcode = lc_excluding-mail. APPEND lwa_excluding TO ct_excluding. lwa_excluding-fcode = lc_excluding-graph.

APPEND lwa_excluding TO ct_excluding. lwa_excluding-fcode = lc_excluding-info. APPEND lwa_excluding TO ct_excluding. ENDFORM. "prepare_pf_status *&---------------------------------------------------------------------* *& Form prepare_layout *&---------------------------------------------------------------------* FORM prepare_layout CHANGING cs_layout TYPE slis_layout_alv. cs_layout-colwidth_optimize = abap_true. cs_layout-zebra = abap_true. * cs_layout-def_status = space. ENDFORM. "prepare_layout *&---------------------------------------------------------------------* *& Form show_alv_grid *&---------------------------------------------------------------------* FORM show_alv_grid USING ut_fieldcat TYPE slis_t_fieldcat_alv ut_sort TYPE slis_t_sortinfo_alv ut_excluding TYPE slis_t_extab us_layout TYPE slis_layout_alv. DATA: lv_repid TYPE sy-repid. CONSTANTS lc_user_command TYPE slis_formname VALUE 'USER_COMMAND'. lv_repid = sy-repid. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING i_callback_program = lv_repid i_callback_user_command = lc_user_command is_layout = us_layout it_fieldcat = ut_fieldcat it_excluding = ut_excluding it_sort = ut_sort TABLES t_outtab = gt_firstlist EXCEPTIONS program_error = 1 OTHERS = 2. IF sy-subrc <> 0. "#EC NEEDED ENDIF. ENDFORM. "show_alv_grid *&---------------------------------------------------------------------* *& Form user_command *&---------------------------------------------------------------------* FORM user_command USING uv_ucomm TYPE sy-ucomm us_selfield TYPE slis_selfield. "#EC CALLED CONSTANTS lco_dclick LIKE uv_ucomm VALUE '&IC1'. CASE uv_ucomm. WHEN lco_dclick. CLEAR:gv_flag1,gv_flag2,gv_flag3,gv_flag4. IF us_selfield-fieldname = 'ERROR'(001). gv_flag1 = 1. PERFORM show_payload_error USING us_selfield-tabindex. ELSEIF us_selfield-fieldname = 'SCHEDULED'(002). gv_flag2 = 1.

PERFORM show_payload_scheduled USING us_selfield-tabindex. ELSEIF us_selfield-fieldname = 'SUCCESS'(003). gv_flag3 = 1. PERFORM show_payload_success USING us_selfield-tabindex. ELSEIF us_selfield-fieldname = 'CANCELLED'(015). gv_flag4 = 1. PERFORM show_payload_cancelled USING us_selfield-tabindex. ENDIF. ENDCASE. ENDFORM. "user_command *&---------------------------------------------------------------------* *& Form SHOW_PAYLOAD_ERROR *&---------------------------------------------------------------------* FORM show_payload_error USING uv_index TYPE slis_selfield-tabindex. DATA:lwa_output TYPE ty_zsxmb_moni_output1, lwa_zsxmb_moni TYPE ty_zsxmb_moni, lwa_idtab TYPE ty_idtab, lv_apperr TYPE string, lwa_msgid TYPE ty_msgid, lwa_syst_ertxt TYPE ty_syst_ertxt. DATA : lv_table TYPE zint_master-zstructure, lv_interface TYPE zint_master-zinterface. CLEAR :lwa_output,lwa_msgid,gt_msgid,gv_index. READ TABLE gt_main INTO lwa_output INDEX uv_index . gv_index = uv_index. IF lwa_output IS NOT INITIAL. IF lwa_output-ob_name IS NOT INITIAL. LOOP AT gt_zsxmb_moni INTO lwa_zsxmb_moni WHERE ob_system = lwa_output-ob_system AND ob_name = lwa_output-ob_name AND * ib_system = lwa_output-ib_system AND * ib_name = lwa_output-ib_name AND msgstate IN gt_msgstate_err. lwa_msgid-msgguid = lwa_zsxmb_moni-msgguid. CASE lwa_zsxmb_moni-msgstate. *Read system error text WHEN '014' OR '018' OR '022' OR '023' OR '037' OR '111' OR '114'. READ TABLE gt_syst_ertxt INTO lwa_syst_ertxt WITH KEY msgguid = lwa_msgid-msgguid. IF sy-subrc EQ 0. lwa_msgid-errormsg = lwa_syst_ertxt-errtxt. ENDIF. *Read Application error text WHEN '017' OR '024' OR '025' OR '117'. CLEAR lv_apperr. PERFORM get_apperr USING lwa_zsxmb_moni lv_apperr. lwa_msgid-errormsg = lv_apperr. ENDCASE. APPEND lwa_msgid TO gt_msgid. CLEAR lwa_msgid. ENDLOOP. ELSE. LOOP AT gt_zsxmb_moni INTO lwa_zsxmb_moni

* *

WHERE ib_system = lwa_output-ib_system AND ib_name = lwa_output-ib_name AND ib_system = lwa_output-ib_system AND ib_name = lwa_output-ib_name AND msgstate IN gt_msgstate_err.

lwa_msgid-msgguid = lwa_zsxmb_moni-msgguid. CASE lwa_zsxmb_moni-msgstate. *Read system error text WHEN '014' OR '018' OR '022' OR '023' OR '037' OR '111' OR '114'. READ TABLE gt_syst_ertxt INTO lwa_syst_ertxt WITH KEY msgguid = lwa_msgid-msgguid. IF sy-subrc EQ 0. lwa_msgid-errormsg = lwa_syst_ertxt-errtxt. ENDIF. *Read Application error text WHEN '017' OR '024' OR '025' OR '117'. CLEAR lv_apperr. PERFORM get_apperr USING lwa_zsxmb_moni lv_apperr. lwa_msgid-errormsg = lv_apperr. ENDCASE. APPEND lwa_msgid TO gt_msgid. CLEAR lwa_msgid. ENDLOOP. ENDIF. ENDIF. CLEAR :lwa_idtab,gt_idtab1. IF gt_msgid[] IS NOT INITIAL. LOOP AT gt_msgid INTO lwa_msgid. READ TABLE gt_idtab INTO gwa_idtab WITH KEY msgguid = lwa_msgid-msgguid. IF sy-subrc EQ 0. lwa_idtab = gwa_idtab. lwa_idtab-errormsg = lwa_msgid-errormsg. ENDIF. APPEND lwa_idtab TO gt_idtab1. ENDLOOP. * else. * MESSAGE 'There is no system or application error exist for this interface' TYPE 'I' DISPLAY LIKE 'E'. ENDIF. *Logic to fetch the structure name from ztable zint_master. SELECT SINGLE zstructure zinterface FROM zint_master INTO (lv_table, lv_interface) WHERE zinterface = lwa_output-ob_name OR zinterface = lwa_output-ib_name . IF sy-subrc EQ 0. PERFORM extract_payload TABLES gt_idtab1 USING lv_table lv_interface gv_index. ELSE. MESSAGE 'No structure for the interface selected'(016) TYPE 'I' DISPLAY LIKE 'E'. ENDIF. ENDFORM. " SHOW_PAYLOAD_ERROR *&---------------------------------------------------------------------* *& Form EXTRACT_PAYLOAD *&---------------------------------------------------------------------*

FORM extract_payload TABLES gt_idtab LIKE gt_idtab1 USING ut_table TYPE zint_master-zstructure uv_interface TYPE zint_master-zinterface uv_index LIKE gv_index. DATA : lr_persist_main TYPE REF TO cl_xms_persist. DATA : lr_xms_msg_main TYPE REF TO if_xms_message . DATA : lr_xmb_msg_main TYPE REF TO if_xms_message_xmb. DATA : lt_payload TYPE sxms_mmfpayloads. DATA : lwa_payload LIKE LINE OF lt_payload. DATA: lr_ixmlfactory TYPE REF TO if_ixml, lr_iparser TYPE REF TO if_ixml_parser, lr_streamfactory TYPE REF TO if_ixml_stream_factory, lr_istream TYPE REF TO if_ixml_istream, lr_idocument TYPE REF TO if_ixml_document, lv_name TYPE string, lv_len TYPE i, "#EC NEEDED lv_value TYPE string. DATA :lr_lxml_rec_list TYPE REF TO if_ixml_node_list , lr_lxml_rec_iterator TYPE REF TO if_ixml_node_iterator , lr_lxml_rec_node TYPE REF TO if_ixml_node, lr_lxml_rec_child_list TYPE REF TO if_ixml_node_list , lr_lxml_rec_child_itertaor TYPE REF TO if_ixml_node_iterator , lr_lxml_rec_child_node TYPE REF TO if_ixml_node, lv_name1 TYPE string, lv_value1 TYPE string, lr_lxml_rec_child_list1 TYPE REF TO if_ixml_node_list , lr_lxml_rec_child_itertaor1 TYPE REF TO if_ixml_node_iterator , lr_lxml_rec_child_node1 TYPE REF TO if_ixml_node, lr_lxml_root TYPE REF TO if_ixml_node, *top of list lr_content TYPE REF TO cl_salv_form_element. FIELD-SYMBOLS: <lft_data> TYPE STANDARD TABLE , <lfs_data> TYPE any, <fs_fldval> TYPE any. DATA: lr_o_sdescr TYPE REF TO cl_abap_structdescr, lr_o_sdescr_new TYPE REF TO cl_abap_structdescr, lr_o_tdescr TYPE REF TO cl_abap_tabledescr, lr_o_handle TYPE REF TO data, lt_components TYPE abap_component_tab, lwa_components LIKE LINE OF lt_components. * Describe structure lr_o_sdescr ?= cl_abap_structdescr=>describe_by_name( ut_table ). lt_components = lr_o_sdescr->get_components( ). DELETE lt_components WHERE name = 'CONTROLLER'. CLEAR: lwa_components. lwa_components-name = 'ERROR_MSG'. lwa_components-type ?= cl_abap_elemdescr=>describe_by_name( 'ALV_STRING' ). APPEND lwa_components TO lt_components. CLEAR: lwa_components. lwa_components-name = 'MSGGUID'.

lwa_components-type ?= cl_abap_elemdescr=>describe_by_name( 'SXMSMGUID' ). * APPEND lwa_components TO lt_components. INSERT lwa_components INTO lt_components INDEX 1. *Create instances of dynamic structure and dynamic internal table lr_o_sdescr_new = cl_abap_structdescr=>create( lt_components ). lr_o_tdescr = cl_abap_tabledescr=>create( lr_o_sdescr_new ). * Create the internal table dynamically based on the components CREATE DATA lr_o_handle TYPE HANDLE lr_o_tdescr. " !!! ASSIGN lr_o_handle->* TO <lft_data>. * Create the structure dynamically based on the components CREATE DATA lr_o_handle TYPE HANDLE lr_o_sdescr_new. ASSIGN lr_o_handle->* TO <lfs_data>. * DATA: lt_msgpayload TYPE sxms_messagepayload_tab. * LWA_MSGPAYLOAD LIKE LINE OF LT_MSGPAYLOAD. IF gt_idtab[] IS NOT INITIAL. LOOP AT gt_idtab INTO gwa_idtab. TRY. CREATE OBJECT lr_persist_main. CALL METHOD lr_persist_main->read_msg_all EXPORTING im_msgguid = gwa_idtab-msgguid im_pid = gwa_idtab-pid im_version = gwa_idtab-rest_vers IMPORTING ex_message = lr_xms_msg_main. lr_xmb_msg_main ?= lr_xms_msg_main. CALL METHOD lr_xmb_msg_main->get_main_payloads RECEIVING return = lt_payload. IF lt_payload IS NOT INITIAL. READ TABLE lt_payload INTO lwa_payload INDEX 1. "Fetched the payload of XML ID DATA:lv_payxstr TYPE xstring. TRY. CALL METHOD lwa_payload-mainpayload->getbinarycontent RECEIVING return = lv_payxstr. CATCH cx_xms_exception . CATCH cx_xms_system_error . ENDTRY. "#EC NO_HANDLER "#EC NO_HANDLER

CLASS cl_ixml DEFINITION LOAD. lr_ixmlfactory = cl_ixml=>create( ). lr_streamfactory = lr_ixmlfactory->create_stream_factory( ). * ). lr_idocument = lr_ixmlfactory->create_document( ). lr_iparser = lr_ixmlfactory->create_parser( stream_factory = lr_streamfactory istream = lr_istream Create DOM lr_istream = lr_streamfactory->create_istream_xstring( lv_payxstr

document lr_iparser->parse( ). *

= lr_idocument ).

start wiht the Root of XML document lr_lxml_root = lr_idocument->get_root_element( ). lv_name = lr_lxml_root->get_name( ). CLEAR lv_name. lr_lxml_rec_list = lr_lxml_root->get_children( ). lv_len = lr_lxml_rec_list->get_length( ). * break dikumar. lr_lxml_rec_iterator = lr_lxml_rec_list->create_iterator( ). "get al l the records lr_lxml_rec_node = lr_lxml_rec_iterator->get_next( ). WHILE lr_lxml_rec_node IS NOT INITIAL. " Loop through RECORDS lr_lxml_rec_child_list = lr_lxml_rec_node->get_children( ). lr_lxml_rec_child_itertaor = lr_lxml_rec_child_list->create_iterat or( ). lr_lxml_rec_child_node = lr_lxml_rec_child_itertaor->get_next( ). WHILE lr_lxml_rec_child_node IS NOT INITIAL. "loop through childen of RECORDS lv_name = lr_lxml_rec_child_node->get_name( ). lv_value = lr_lxml_rec_child_node->get_value( ). TRANSLATE lv_name TO UPPER CASE. ASSIGN COMPONENT lv_name OF STRUCTURE <lfs_data> TO <fs_fldval>. IF sy-subrc EQ 0. <fs_fldval> = lv_value. ELSE. IF lv_name EQ 'VENDORHEADER'. lr_lxml_rec_child_list1 = lr_lxml_rec_child_node->get_childr en( ). lr_lxml_rec_child_itertaor1 = lr_lxml_rec_child_list1->creat e_iterator( ). lr_lxml_rec_child_node1 = lr_lxml_rec_child_itertaor1->get_n ext( ). WHILE lr_lxml_rec_child_node1 IS NOT INITIAL. "loop through childen of RECORDS lv_name1 = lr_lxml_rec_child_node1->get_name( ). lv_value1 = lr_lxml_rec_child_node1->get_value( ). TRANSLATE lv_name1 TO UPPER CASE. ASSIGN COMPONENT lv_name1 OF STRUCTURE <lfs_data> TO <fs_f ldval>. IF sy-subrc EQ 0. <fs_fldval> = lv_value1. ENDIF. CLEAR: lv_name1, lv_value1. lr_lxml_rec_child_node1 = lr_lxml_rec_child_itertaor1->get _next( ). ENDWHILE. "End loop through childen of RECORDS ENDIF. ENDIF. CLEAR: lv_name, lv_value. lr_lxml_rec_child_node = lr_lxml_rec_child_itertaor->get_next( ) . ENDWHILE. "End loop through childen of RECORDS

IF <lfs_data> IS NOT INITIAL . ASSIGN COMPONENT 'ERROR_MSG' OF STRUCTURE <lfs_data> TO <fs_fldv al>. IF sy-subrc EQ 0. *" Move the Error Message to this field <fs_fldval> = gwa_idtab-errormsg. ENDIF. ASSIGN COMPONENT 'MSGGUID' OF STRUCTURE <lfs_data> TO <fs_fldval >. IF sy-subrc EQ 0. *" Move the Message id to this field <fs_fldval> = gwa_idtab-msgguid . ENDIF. APPEND <lfs_data> TO <lft_data>. CLEAR <lfs_data>. ENDIF. lr_lxml_rec_node = lr_lxml_rec_iterator->get_next( ). "Get next re cord ENDWHILE. "End Loop through RECORDS ENDIF. CLEAR gwa_idtab. CATCH cx_xms_syserr_persist. ENDTRY. CLEAR gwa_idtab. ENDLOOP.

"#EC NO_HANDLER

DATA: lr_o_alvgrid TYPE REF TO cl_salv_table, lr_o_cols TYPE REF TO cl_salv_columns_table, lr_o_layout TYPE REF TO cl_salv_layout, lr_o_functions TYPE REF TO cl_salv_functions_list, lr_o_col TYPE REF TO cl_salv_column, lt_colref TYPE salv_t_column_ref, lwa_colref LIKE LINE OF lt_colref, lv_lines1 TYPE syst-tabix, lv_seltext_l TYPE scrtext_l, lv_seltext_s TYPE scrtext_s. IF <lft_data> IS NOT INITIAL. TRY. DESCRIBE TABLE <lft_data> LINES lv_lines1. CALL METHOD cl_salv_table=>factory EXPORTING list_display = if_salv_c_bool_sap=>false IMPORTING r_salv_table = lr_o_alvgrid CHANGING t_table = <lft_data>. lr_o_layout = lr_o_alvgrid->get_layout( ) . lr_o_layout->set_default( abap_true ). CALL METHOD lr_o_alvgrid->get_functions RECEIVING value = lr_o_functions. lr_o_functions->set_all( abap_true ). CALL METHOD lr_o_alvgrid->get_columns RECEIVING value = lr_o_cols. lt_colref = lr_o_cols->get( ). *Add field description on display 2nd list

SORT gt_field_desc BY zinterface zfield_name. CLEAR gwa_field_desc. DATA: lv_ddtext TYPE dd03t-ddtext. LOOP AT lt_colref INTO lwa_colref. lv_seltext_l = lwa_colref-columnname. IF lwa_colref-columnname EQ 'ERROR_MSG'. lv_seltext_l = 'Error Messages'(017). lv_seltext_s = 'Error Msgs'(018). lwa_colref-r_column->set_output_length( 1000 ). CALL METHOD lwa_colref-r_column->set_short_text EXPORTING value = lv_seltext_s. CALL METHOD lwa_colref-r_column->set_long_text EXPORTING value = lv_seltext_l. ELSE. SELECT SINGLE ddtext FROM dd03t INTO lv_ddtext WHERE tabname = ut_table AND ddlanguage = sy-langu AND as4local = 'A' AND fieldname = lwa_colref-columnname. IF sy-subrc EQ 0 AND lv_ddtext IS NOT INITIAL. lv_seltext_l = lv_ddtext. CALL METHOD lwa_colref-r_column->set_long_text EXPORTING value = lv_seltext_l. ELSE. READ TABLE gt_field_desc INTO gwa_field_desc WITH KEY zinterface = uv_interface zfield_name = lwa_colref-columnname BINARY SEARC H. "#EC WARNOK IF sy-subrc EQ 0 AND gwa_field_desc-zfield_desc NE space. lv_seltext_l = gwa_field_desc-zfield_desc. CALL METHOD lwa_colref-r_column->set_long_text EXPORTING value = lv_seltext_l. ELSE. CALL METHOD lwa_colref-r_column->set_long_text EXPORTING value = lv_seltext_l. ENDIF. ENDIF. ENDIF. CLEAR gwa_field_desc. ENDLOOP. CALL METHOD lr_o_cols->set_optimize EXPORTING value = if_salv_c_bool_sap=>true. TRY. lr_o_col = lr_o_cols->get_column( columnname = 'CONTROLLER' ). lr_o_col->set_technical( EXPORTING value = if_salv_c_bool_sap=>tr ue ). CATCH cx_salv_not_found . ENDTRY. *top of page PERFORM built_header USING uv_index lv_lines1 "#EC NO_HANDLER

CHANGING lr_content. lr_o_alvgrid->set_top_of_list( lr_content ). DATA: lr_o_selects TYPE REF TO cl_salv_selections. lr_o_selects = lr_o_alvgrid->get_selections( ). CALL METHOD lr_o_selects->set_selection_mode EXPORTING value = if_salv_c_selection_mode=>single. CALL METHOD lr_o_alvgrid->display( ) . CATCH cx_salv_msg . ENDTRY. "#EC NO_HANDLER

ELSE. MESSAGE 'No payload extracted!'(019) TYPE 'I' DISPLAY LIKE 'E'. * LEAVE TO CURRENT TRANSACTION. RETURN. ENDIF. ENDIF. ENDFORM. " EXTRACT_PAYLOAD *&---------------------------------------------------------------------* *& Form BUILT_HEADER *&---------------------------------------------------------------------* FORM built_header USING uv_index TYPE slis_selfield-tabindex uv_lines TYPE syst-tabix CHANGING cr_content TYPE REF TO cl_salv_form_element. DATA: lwa_output LIKE LINE OF gt_firstlist, lr_grid TYPE REF TO cl_salv_form_layout_grid, lr_label TYPE REF TO cl_salv_form_label, lr_text TYPE REF TO cl_salv_form_text. READ TABLE gt_firstlist INTO lwa_output INDEX uv_index ."REFERENCE INTO lwa_ou tput. IF lwa_output IS NOT INITIAL. CREATE OBJECT lr_grid. *For sender lr_label = lr_grid->create_label( row = 1 column = 1 text = 'Sender'(020) tooltip = 'Sender'(020) ). lr_text = lr_grid->create_text( row = 1 column = 4 text = lwa_output-ob_system tooltip = lwa_output-ob_system ). lr_label->set_label_for( lr_text ). *For reciever lr_label = lr_grid->create_label( row = 2 column = 1 text = 'Receiver'(021) tooltip = 'Receiver'(021) ). lr_text = lr_grid->create_text( row = 2 column = 4 text = lwa_output-ib_system

tooltip = lwa_output-ib_system ). lr_label->set_label_for( lr_text ). **For Interface name space lr_label = lr_grid->create_label( row = 3 column = 1 text = 'Interface Namespace'(022) tooltip = 'Interface Namespace'(022) ). lr_text = lr_grid->create_text( row = 3 column = 4 text = lwa_output-intr_ns tooltip = lwa_output-intr_ns ). lr_label->set_label_for( lr_text ). **For interface name lr_label = lr_grid->create_label( row = 4 column = 1 text = 'Interface Name'(t02) tooltip = 'Interface Name'(t02) ). lr_text = lr_grid->create_text( row = 4 column = 4 text = lwa_output-intr_name tooltip = lwa_output-intr_name ). lr_label->set_label_for( lr_text ). **For Interface description lr_label = lr_grid->create_label( row = 5 column = 1 text = 'Description of Interface'(023) tooltip = 'Description of Interface'(023) ). lr_text = lr_grid->create_text( row = 5 column = 4 text = lwa_output-zdesc tooltip = lwa_output-zdesc ). lr_label->set_label_for( lr_text ). **For error count IF gv_flag1 = 1. lr_label = lr_grid->create_label( row = 6 column = 1 text = 'Error Messages'(024) tooltip = 'Error Messages'(024) ). lr_text = lr_grid->create_text( row = 6 column = 4 text = lwa_output-ERROR tooltip = lwa_output-error ). lr_label->set_label_for( lr_text ). ELSEIF gv_flag2 = 1. **For scheduled count lr_label row column text tooltip = = = = = lr_grid->create_label( 6 1 'Scheduled Messages'(025) 'Scheduled Messages'(025) ).

lr_text = lr_grid->create_text( row = 6 column = 4 text = lwa_output-SCHEDULED tooltip = lwa_output-scheduled ). lr_label->set_label_for( lr_text ). ELSEIF gv_flag3 = 1. **For success count lr_label = lr_grid->create_label( row = 6 column = 1 text = 'Success Messages'(026) tooltip = 'Success Messages'(026) ). lr_text = lr_grid->create_text( row = 6 column = 4 text = lwa_output-SUCCESS tooltip = lwa_output-success ). lr_label->set_label_for( lr_text ). ELSEIF gv_flag4 = 1. **For cancelled count lr_label = lr_grid->create_label( row = 6 column = 1 text = 'Cancelled Messages'(027) tooltip = 'Cancelled Messages'(027) ). lr_text = lr_grid->create_text( row = 6 column = 4 text = lwa_output-CANCELLED tooltip = lwa_output-cancelled ). lr_label->set_label_for( lr_text ). ENDIF. cr_content = lr_grid. ENDIF. ENDFORM. " BUILT_HEADER * SHOW_PAYLOAD_SCHEDULED *&---------------------------------------------------------------------* *& Form SHOW_PAYLOAD_SCHEDULED *&---------------------------------------------------------------------* FORM show_payload_scheduled USING uv_index TYPE slis_selfield-tabindex. DATA:lwa_output TYPE ty_zsxmb_moni_output1, lwa_zsxmb_moni TYPE ty_zsxmb_moni, lwa_idtab TYPE ty_idtab, lwa_msgid TYPE ty_msgid. CLEAR :lwa_output,lwa_msgid,gt_msgid,gv_index. READ TABLE gt_main INTO lwa_output INDEX uv_index . "REFERENCE INTO lwa_output . gv_index = uv_index. IF lwa_output IS NOT INITIAL. IF lwa_output-ob_name IS NOT INITIAL. LOOP AT gt_zsxmb_moni INTO lwa_zsxmb_moni WHERE ob_system = lwa_output-ob_system AND ob_name = lwa_output-ob_name AND

msgstate IN gt_msgstate_sch. lwa_msgid-msgguid = lwa_zsxmb_moni-msgguid. APPEND lwa_msgid TO gt_msgid. ENDLOOP. ELSE. LOOP AT gt_zsxmb_moni INTO lwa_zsxmb_moni WHERE ib_system = lwa_output-ib_system AND ib_name = lwa_output-ib_name AND msgstate IN gt_msgstate_sch. lwa_msgid-msgguid = lwa_zsxmb_moni-msgguid. APPEND lwa_msgid TO gt_msgid. ENDLOOP. ENDIF. ENDIF. CLEAR: lwa_idtab,gt_idtab1. LOOP AT gt_msgid INTO lwa_msgid. READ TABLE gt_idtab INTO gwa_idtab WITH KEY msgguid = lwa_msgid-msgguid. IF sy-subrc EQ 0. lwa_idtab = gwa_idtab. ENDIF. APPEND lwa_idtab TO gt_idtab1. ENDLOOP. **Logic to fetch the structure name from ztable(yet to create the ztable) DATA :lwa_int_struct TYPE zint_master. SELECT FROM INTO WHERE SINGLE * zint_master lwa_int_struct zinterface = lwa_output-ob_name OR zinterface = lwa_output-ib_name.

IF sy-subrc EQ 0. PERFORM extract_payload_s TABLES gt_idtab1 USING lwa_int_struct-zstructure lwa_int_struct-zinterface gv_index. ELSE. MESSAGE 'No structure for the interface selected'(016) TYPE 'I' DISPLAY LIKE 'E'. ENDIF. ENDFORM. " SHOW_PAYLOAD_SCHEDULED *&---------------------------------------------------------------------* *& Form EXTRACT_PAYLOAD_S *&---------------------------------------------------------------------* FORM extract_payload_s TABLES gt_idtab LIKE gt_idtab1 USING ut_table TYPE zint_master-zstructure uv_interface TYPE zint_master-zinterface uv_index LIKE gv_index. DATA : lr_persist_main TYPE REF TO cl_xms_persist. DATA : lr_xms_msg_main TYPE REF TO if_xms_message . DATA : lr_xmb_msg_main TYPE REF TO if_xms_message_xmb. DATA : lt_payload TYPE sxms_mmfpayloads. DATA : lwa_payload LIKE LINE OF lt_payload. DATA: lr_ixmlfactory TYPE REF TO if_ixml,

lr_iparser TYPE REF TO lr_streamfactory TYPE REF TO lr_istream TYPE REF TO lr_idocument TYPE REF TO lv_name TYPE string, lv_value TYPE string, lv_name1 TYPE string, lv_value1 TYPE string.

if_ixml_parser, if_ixml_stream_factory, if_ixml_istream, if_ixml_document,

DATA :lr_lxml_rec_list TYPE REF TO if_ixml_node_list , lr_lxml_rec_iterator TYPE REF TO if_ixml_node_iterator , lr_lxml_rec_node TYPE REF TO if_ixml_node, lr_lxml_rec_child_list TYPE REF TO if_ixml_node_list , lr_lxml_rec_child_itertaor TYPE REF TO if_ixml_node_iterator , lr_lxml_rec_child_node TYPE REF TO if_ixml_node, lr_lxml_rec_child_list1 TYPE REF TO if_ixml_node_list , lr_lxml_rec_child_itertaor1 TYPE REF TO if_ixml_node_iterator , lr_lxml_rec_child_node1 TYPE REF TO if_ixml_node, lr_lxml_root TYPE REF TO if_ixml_node. *top of list DATA: lr_content TYPE REF TO cl_salv_form_element. FIELD-SYMBOLS: <lft_data> TYPE STANDARD TABLE , <lfs_data> TYPE any, <fs_fldval> TYPE any. DATA: lr_o_sdescr_new TYPE REF TO cl_abap_structdescr, lr_o_tdescr TYPE REF TO cl_abap_tabledescr, lr_o_handle TYPE REF TO data, lt_components TYPE abap_component_tab, lwa_components LIKE LINE OF lt_components. DATA: lr_o_ref TYPE REF TO cl_abap_structdescr. lr_o_ref ?= cl_abap_typedescr=>describe_by_name( p_name = ut_table ). lt_components = lr_o_ref->get_components( ). DELETE lt_components WHERE name = 'CONTROLLER'. CLEAR: lwa_components. lwa_components-name = 'MSGGUID'. lwa_components-type ?= cl_abap_elemdescr=>describe_by_name( 'SXMSMGUID' ). INSERT lwa_components INTO lt_components INDEX 1. " Create instances of dynamic structure and dynamic internal table lr_o_sdescr_new = cl_abap_structdescr=>create( lt_components ). lr_o_tdescr = cl_abap_tabledescr=>create( lr_o_sdescr_new ). * Create the internal table dynamically based on the components CREATE DATA lr_o_handle TYPE HANDLE lr_o_tdescr. " !!! ASSIGN lr_o_handle->* TO <lft_data>. * Create the structure dynamically based on the components CREATE DATA lr_o_handle TYPE HANDLE lr_o_sdescr_new. ASSIGN lr_o_handle->* TO <lfs_data>. IF gt_idtab1 IS NOT INITIAL. LOOP AT gt_idtab INTO gwa_idtab. TRY. CREATE OBJECT lr_persist_main. CALL METHOD lr_persist_main->read_msg_all EXPORTING im_msgguid = gwa_idtab-msgguid

im_pid = gwa_idtab-pid im_version = gwa_idtab-rest_vers IMPORTING ex_message = lr_xms_msg_main. lr_xmb_msg_main ?= lr_xms_msg_main. CALL METHOD lr_xmb_msg_main->get_main_payloads RECEIVING return = lt_payload. IF lt_payload IS NOT INITIAL. READ TABLE lt_payload INTO lwa_payload INDEX 1. "Fetched the payload of XML ID DATA:lv_payxstr TYPE xstring. TRY. CALL METHOD lwa_payload-mainpayload->getbinarycontent RECEIVING return = lv_payxstr. CATCH cx_xms_exception . CATCH cx_xms_system_error . ENDTRY. "#EC NO_HANDLER "#EC NO_HANDLER

CLASS cl_ixml DEFINITION LOAD. lr_ixmlfactory = cl_ixml=>create( ). lr_streamfactory = lr_ixmlfactory->create_stream_factory( ). * ). lr_idocument = lr_ixmlfactory->create_document( ). lr_iparser = lr_ixmlfactory->create_parser( stream_factory = lr_streamfactory istream = lr_istream document = lr_idocument ). lr_iparser->parse( ). * start wiht the Root of XML document lr_lxml_root = lr_idocument->get_root_element( ). lv_name = lr_lxml_root->get_name( ). CLEAR lv_name. lr_lxml_rec_list = lr_lxml_root->get_children( ). lr_lxml_rec_iterator = lr_lxml_rec_list->create_iterator( ). "get al l the records lr_lxml_rec_node = lr_lxml_rec_iterator->get_next( ). WHILE lr_lxml_rec_node IS NOT INITIAL. " Loop through RECORDS lr_lxml_rec_child_list = lr_lxml_rec_node->get_children( ). lr_lxml_rec_child_itertaor = lr_lxml_rec_child_list->create_iterat or( ). lr_lxml_rec_child_node = lr_lxml_rec_child_itertaor->get_next( ). WHILE lr_lxml_rec_child_node IS NOT INITIAL. "loop through childen of RECORDS lv_name = lr_lxml_rec_child_node->get_name( ). lv_value = lr_lxml_rec_child_node->get_value( ). TRANSLATE lv_name TO UPPER CASE. ASSIGN COMPONENT lv_name OF STRUCTURE <lfs_data> TO <fs_fldval>. IF sy-subrc EQ 0. <fs_fldval> = lv_value. Create DOM lr_istream = lr_streamfactory->create_istream_xstring( lv_payxstr

ELSE. IF lv_name EQ 'VENDORHEADER'. lr_lxml_rec_child_list1 = lr_lxml_rec_child_node->get_childr en( ). lr_lxml_rec_child_itertaor1 = lr_lxml_rec_child_list1->creat e_iterator( ). lr_lxml_rec_child_node1 = lr_lxml_rec_child_itertaor1->get_n ext( ). WHILE lr_lxml_rec_child_node1 IS NOT INITIAL. "loop through childen of RECORDS lv_name1 = lr_lxml_rec_child_node1->get_name( ). lv_value1 = lr_lxml_rec_child_node1->get_value( ). TRANSLATE lv_name1 TO UPPER CASE. ASSIGN COMPONENT lv_name1 OF STRUCTURE <lfs_data> TO <fs_f ldval>. IF sy-subrc EQ 0. <fs_fldval> = lv_value1. ENDIF. CLEAR: lv_name1, lv_value1. lr_lxml_rec_child_node1 = lr_lxml_rec_child_itertaor1->get _next( ). ENDWHILE. "End loop through childen of RECORDS ENDIF. ENDIF. CLEAR: lv_name, lv_value. lr_lxml_rec_child_node = lr_lxml_rec_child_itertaor->get_next( ) . ENDWHILE. "End loop through childen of RECORDS IF <lfs_data> IS NOT INITIAL . ASSIGN COMPONENT 'MSGGUID' OF STRUCTURE <lfs_data> TO <fs_fldval >. IF sy-subrc EQ 0. *" Move the Error MEssage to this field <fs_fldval> = gwa_idtab-msgguid . ENDIF. APPEND <lfs_data> TO <lft_data>. CLEAR <lfs_data>. ENDIF. lr_lxml_rec_node = lr_lxml_rec_iterator->get_next( ). "Get next re cord ENDWHILE. "End Loop through RECORDS * ELSE. MESSAGE 'No Message found to Display'(028) TYPE 'I' DISPLAY LIKE 'E' . ENDIF. CLEAR gwa_idtab. CATCH cx_xms_syserr_persist. ENDTRY. CLEAR gwa_idtab. ENDLOOP. "#EC NO_HANDLER

DATA: lr_o_alvgrid TYPE REF TO cl_salv_table, lr_o_cols TYPE REF TO cl_salv_columns_table, lr_o_col TYPE REF TO cl_salv_column, lr_o_layout TYPE REF TO cl_salv_layout, lr_o_functions TYPE REF TO cl_salv_functions_list, lv_lines1 TYPE syst-tabix,

lt_colref TYPE salv_t_column_ref, lwa_colref LIKE LINE OF lt_colref, lv_seltext_l TYPE scrtext_l. DATA: lv_ddtext TYPE dd03t-ddtext. SORT gt_field_desc BY zinterface zfield_name. IF <lft_data> IS NOT INITIAL. TRY. DESCRIBE TABLE <lft_data> LINES lv_lines1. CALL METHOD cl_salv_table=>factory EXPORTING list_display = if_salv_c_bool_sap=>false IMPORTING r_salv_table = lr_o_alvgrid CHANGING t_table = <lft_data>. lr_o_layout = lr_o_alvgrid->get_layout( ) . lr_o_layout->set_default( abap_true ). CALL METHOD lr_o_alvgrid->get_functions RECEIVING value = lr_o_functions. lr_o_functions->set_all( abap_true ). CALL METHOD lr_o_alvgrid->get_columns RECEIVING value = lr_o_cols. lt_colref = lr_o_cols->get( ). *Add field description on display 2nd list CLEAR gwa_field_desc. LOOP AT lt_colref INTO lwa_colref. lv_seltext_l = lwa_colref-columnname. SELECT SINGLE ddtext FROM dd03t INTO lv_ddtext WHERE tabname = ut_table AND ddlanguage = sy-langu AND as4local = 'A' AND fieldname = lwa_colref-columnname. IF sy-subrc EQ 0 AND lv_ddtext IS NOT INITIAL. lv_seltext_l = lv_ddtext. CALL METHOD lwa_colref-r_column->set_long_text EXPORTING value = lv_seltext_l. ELSE. READ TABLE gt_field_desc INTO gwa_field_desc WITH KEY zinterface = uv_interface zfield_name = lwa_colref-columnname BINARY SEARCH. "#EC WARNOK IF sy-subrc EQ 0 AND gwa_field_desc-zfield_desc NE space. lv_seltext_l = gwa_field_desc-zfield_desc. CALL METHOD EXPORTING value = ELSE. CALL METHOD EXPORTING value = ENDIF. ENDIF. lwa_colref-r_column->set_long_text lv_seltext_l. lwa_colref-r_column->set_long_text lv_seltext_l.

CLEAR gwa_field_desc. ENDLOOP. CALL METHOD lr_o_cols->set_optimize EXPORTING value = if_salv_c_bool_sap=>true. TRY. lr_o_col = lr_o_cols->get_column( columnname = 'CONTROLLER' ). lr_o_col->set_technical( EXPORTING value = if_salv_c_bool_sap=>tr ue ). CATCH cx_salv_not_found . "#EC NO_HANDLER ENDTRY. *top of page PERFORM built_header USING uv_index lv_lines1 CHANGING lr_content. lr_o_alvgrid->set_top_of_list( lr_content ). DATA: lr_o_selects TYPE REF TO cl_salv_selections. lr_o_selects = lr_o_alvgrid->get_selections( ). lr_o_selects->set_selection_mode( if_salv_c_selection_mode=>single ). CALL METHOD lr_o_alvgrid->display( ) . CATCH cx_salv_msg . "#EC NO_HANDLER ENDTRY. ELSE. MESSAGE 'No payload extracted'(029) TYPE 'I' DISPLAY LIKE 'E'. * LEAVE TO CURRENT TRANSACTION. RETURN. ENDIF. ENDIF. ENDFORM. " EXTRACT_PAYLOAD_S *&---------------------------------------------------------------------* *& Form SHOW_PAYLOAD_SUCCESS *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_RS_SELFIELD_TABINDEX text *----------------------------------------------------------------------* FORM show_payload_success USING uv_index TYPE slis_selfield-tabindex. DATA:lwa_output TYPE ty_zsxmb_moni_output1, lwa_zsxmb_moni TYPE ty_zsxmb_moni, lwa_idtab TYPE ty_idtab, lwa_msgid TYPE ty_msgid. CLEAR :lwa_output,lwa_msgid,gt_msgid,gv_index. READ TABLE gt_main INTO lwa_output INDEX uv_index ."REFERENCE INTO lwa_output. gv_index = uv_index. IF lwa_output IS NOT INITIAL. IF lwa_output-ob_name IS NOT INITIAL. LOOP AT gt_zsxmb_moni INTO lwa_zsxmb_moni WHERE ob_system = lwa_output-ob_system AND ob_name = lwa_output-ob_name AND msgstate IN gt_msgstate_suc. lwa_msgid-msgguid = lwa_zsxmb_moni-msgguid. APPEND lwa_msgid TO gt_msgid. ENDLOOP.

ELSE. LOOP AT gt_zsxmb_moni INTO lwa_zsxmb_moni WHERE ib_system = lwa_output-ib_system AND ib_name = lwa_output-ib_name AND msgstate IN gt_msgstate_suc. lwa_msgid-msgguid = lwa_zsxmb_moni-msgguid. APPEND lwa_msgid TO gt_msgid. ENDLOOP. ENDIF. ENDIF. CLEAR: lwa_idtab,gt_idtab1. LOOP AT gt_msgid INTO lwa_msgid. READ TABLE gt_idtab INTO gwa_idtab WITH KEY msgguid = lwa_msgid-msgguid. IF sy-subrc EQ 0. lwa_idtab = gwa_idtab. ENDIF. APPEND lwa_idtab TO gt_idtab1. ENDLOOP. **Logic to fetch the structure name from ztable(yet to create the ztable) DATA : lv_table TYPE zint_master-zstructure, lv_interface TYPE zint_master-zinterface. SINGLE zstructure zinterface zint_master (lv_table, lv_interface) zinterface = lwa_output-ob_name OR zinterface = lwa_output-ib_name . IF sy-subrc EQ 0. PERFORM extract_payload_s TABLES gt_idtab1 USING lv_table lv_interface gv_index. ELSE. MESSAGE 'No structure for the interface selected'(016) TYPE 'I' DISPLAY LIKE 'E'. ENDIF. ENDFORM. " SHOW_PAYLOAD_SUCCESS *&---------------------------------------------------------------------* *& Form SHOW_PAYLOAD_CANCELLED *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_RS_SELFIELD_TABINDEX text *----------------------------------------------------------------------* FORM show_payload_cancelled USING uv_index TYPE slis_selfield-tabindex. DATA:lwa_output TYPE ty_zsxmb_moni_output1, lwa_zsxmb_moni TYPE ty_zsxmb_moni, lwa_idtab TYPE ty_idtab, lwa_msgid TYPE ty_msgid. CLEAR :lwa_output,lwa_msgid,gt_msgid,gv_index. READ TABLE gt_main INTO lwa_output INDEX uv_index ."REFERENCE INTO lwa_output. gv_index = uv_index. IF lwa_output IS NOT INITIAL. IF lwa_output-ob_name IS NOT INITIAL. LOOP AT gt_zsxmb_moni INTO lwa_zsxmb_moni WHERE ob_system = lwa_output-ob_system AND ob_name = lwa_output-ob_name AND SELECT FROM INTO WHERE

msgstate IN gt_msgstate_can. lwa_msgid-msgguid = lwa_zsxmb_moni-msgguid. APPEND lwa_msgid TO gt_msgid. ENDLOOP. ELSE. LOOP AT gt_zsxmb_moni INTO lwa_zsxmb_moni WHERE ib_system = lwa_output-ib_system AND ib_name = lwa_output-ib_name AND msgstate IN gt_msgstate_can. lwa_msgid-msgguid = lwa_zsxmb_moni-msgguid. APPEND lwa_msgid TO gt_msgid. ENDLOOP. ENDIF. ENDIF. CLEAR: lwa_idtab,gt_idtab1. LOOP AT gt_msgid INTO lwa_msgid. READ TABLE gt_idtab INTO gwa_idtab WITH KEY msgguid = lwa_msgid-msgguid. IF sy-subrc EQ 0. lwa_idtab = gwa_idtab. ENDIF. APPEND lwa_idtab TO gt_idtab1. ENDLOOP. **Logic to fetch the structure name from ztable(yet to create the ztable) DATA : gv_table TYPE zint_master-zstructure, lv_interface TYPE zint_master-zinterface. SELECT SINGLE zstructure zinterface FROM zint_master INTO (gv_table, lv_interface) WHERE zinterface = lwa_output-ob_name OR zinterface = lwa_output-ib_name . IF sy-subrc EQ 0. PERFORM extract_payload_s TABLES gt_idtab1 USING gv_table lv_interface gv_index. ELSE. MESSAGE 'No structure for the interface selected'(016) TYPE 'I' DISPLAY LIKE 'E'. ENDIF. ENDFORM. " SHOW_PAYLOAD_CANCELLED *&---------------------------------------------------------------------* *& Form PREPARE_MSGSTATE_RANGES *&---------------------------------------------------------------------* * Initialize Message State Ranges for Error/Success/Schedule/Cancel *----------------------------------------------------------------------* FORM prepare_msgstate_ranges . CLEAR: gt_msgstate_err[], gt_msgstate_suc[], gt_msgstate_sch[], gt_msgstate_can[]. CLEAR: gwa_msgstate_err, gwa_msgstate_suc, gwa_msgstate_sch,

gwa_msgstate_can. *---------------------------------------------------------------------* * *Prepare range table for Error table. *----------------------------------------------------------------------* gwa_msgstate_err-sign gwa_msgstate_err-option gwa_msgstate_err-low APPEND gwa_msgstate_err gwa_msgstate_err-sign gwa_msgstate_err-option gwa_msgstate_err-low APPEND gwa_msgstate_err gwa_msgstate_err-sign gwa_msgstate_err-option gwa_msgstate_err-low APPEND gwa_msgstate_err gwa_msgstate_err-sign gwa_msgstate_err-option gwa_msgstate_err-low APPEND gwa_msgstate_err gwa_msgstate_err-sign gwa_msgstate_err-option gwa_msgstate_err-low APPEND gwa_msgstate_err gwa_msgstate_err-sign gwa_msgstate_err-option gwa_msgstate_err-low APPEND gwa_msgstate_err gwa_msgstate_err-sign gwa_msgstate_err-option gwa_msgstate_err-low APPEND gwa_msgstate_err gwa_msgstate_err-sign gwa_msgstate_err-option gwa_msgstate_err-low APPEND gwa_msgstate_err gwa_msgstate_err-sign gwa_msgstate_err-option gwa_msgstate_err-low APPEND gwa_msgstate_err gwa_msgstate_err-sign gwa_msgstate_err-option gwa_msgstate_err-low APPEND gwa_msgstate_err = 'I'. = 'EQ'. = '014'. TO gt_msgstate_err. = 'I'. = 'EQ'. = '017'. TO gt_msgstate_err. = 'I'. = 'EQ'. = '018'. TO gt_msgstate_err. = 'I'. = 'EQ'. = '022'. TO gt_msgstate_err. = 'I'. = 'EQ'. = '023'. TO gt_msgstate_err. = 'I'. = 'EQ'. = '024'. TO gt_msgstate_err. = 'I'. = 'EQ'. = '025'. TO gt_msgstate_err. = 'I'. = 'EQ'. = '111'. TO gt_msgstate_err. = 'I'. = 'EQ'. = '114'. TO gt_msgstate_err. = 'I'. = 'EQ'. = '117'. TO gt_msgstate_err.

*---------------------------------------------------------------------* * *Prepare range table for Success messages *----------------------------------------------------------------------* CLEAR gwa_msgstate_suc.

gwa_msgstate_suc-sign gwa_msgstate_suc-option gwa_msgstate_suc-low APPEND gwa_msgstate_suc

= 'I'. = 'EQ'. = '003'. TO gt_msgstate_suc.

gwa_msgstate_suc-sign = 'I'. gwa_msgstate_suc-option = 'EQ'. gwa_msgstate_suc-low = '103'. APPEND gwa_msgstate_suc TO gt_msgstate_suc. *---------------------------------------------------------------------* * *Prepare range table for Scheduled messages *----------------------------------------------------------------------* CLEAR gwa_msgstate_sch. gwa_msgstate_sch-sign = 'I'. gwa_msgstate_sch-option = 'EQ'. gwa_msgstate_sch-low = '001'. APPEND gwa_msgstate_sch TO gt_msgstate_sch. gwa_msgstate_sch-sign = 'I'. gwa_msgstate_sch-option = 'EQ'. gwa_msgstate_sch-low = '012'. APPEND gwa_msgstate_sch TO gt_msgstate_sch. *---------------------------------------------------------------------* * *Prepare range table for Cancelled messages *----------------------------------------------------------------------* CLEAR gwa_msgstate_can. gwa_msgstate_can-sign = 'I'. gwa_msgstate_can-option = 'EQ'. gwa_msgstate_can-low = '020'. APPEND gwa_msgstate_can TO gt_msgstate_can. gwa_msgstate_can-sign = 'I'. gwa_msgstate_can-option = 'EQ'. gwa_msgstate_can-low = '021'. APPEND gwa_msgstate_can TO gt_msgstate_can. ENDFORM. " PREPARE_MSGSTATE_RANGES *&---------------------------------------------------------------------* *& Form MESSAGE_LOG_DATA_SELECTION *&---------------------------------------------------------------------* FORM message_log_data_selection . * Declaration of constants CONSTANTS: lc_number TYPE int4 VALUE 2147483646, lc_filter TYPE c LENGTH 11 VALUE 'lwa_filter-', "#EC NOTEXT BEGIN OF lc_pids, sign TYPE sxmsselopt-sign VALUE 'E', option TYPE sxmsselopt-option VALUE 'EQ', central TYPE sxmsselopt-low VALUE 'CENTRAL_BACK', receiver TYPE sxmsselopt-low VALUE 'RECEIVER_BACK', sender TYPE sxmsselopt-low VALUE 'SENDER_BACK', adapter TYPE sxmsselopt-low VALUE 'PE_ADAPTER', process TYPE sxmsselopt-low VALUE 'PE_PROCESS', END OF lc_pids. *Declaration for filter DATA: lt_filter TYPE STANDARD TABLE OF zsxmb_moni_filter. * Declaration of data objects. DATA: lwa_filter TYPE sxi_msg_select, lwa_pids TYPE LINE OF sxi_msg_select-pids,

lt_msgtab lr_msgtab lt_msgtab_aux lr_moni_filter lr_moni_filter_aux lv_times lv_fieldname lwa_zsxmb_moni

TYPE sxmsmsgtab, TYPE REF TO sxmsmsglst, LIKE lt_msgtab, TYPE REF TO zsxmb_moni_filter, TYPE REF TO zsxmb_moni_filter, TYPE zsxmb_moni_filter-filternum VALUE '001', TYPE zsxmb_moni_filter-field, TYPE ty_zsxmb_moni.

* Declaration of field-symbols FIELD-SYMBOLS: <lfs_field> TYPE any. * Determine the number of times that the messages log data * selection must occurs. IF lines( lt_filter ) > 0. READ TABLE lt_filter INDEX 1 REFERENCE INTO lr_moni_filter_aux. LOOP AT lt_filter REFERENCE INTO lr_moni_filter. CHECK lr_moni_filter->filternum <> lr_moni_filter_aux->filternum. lv_times = lv_times + 1. lr_moni_filter_aux = lr_moni_filter. ENDLOOP. FREE lr_moni_filter_aux. ENDIF. DO lv_times TIMES. CLEAR: lwa_filter, lt_msgtab_aux. Move the fixed filter fields to the filter structure. lwa_pids-sign = lc_pids-sign. lwa_pids-option = lc_pids-option. lwa_pids-low = lc_pids-central. APPEND lwa_pids TO lwa_filter-pids. lwa_pids-low = lc_pids-receiver. APPEND lwa_pids TO lwa_filter-pids. lwa_pids-low = lc_pids-sender. APPEND lwa_pids TO lwa_filter-pids. lwa_pids-low = lc_pids-adapter. APPEND lwa_pids TO lwa_filter-pids. lwa_pids-low = lc_pids-process. APPEND lwa_pids TO lwa_filter-pids. Move the importing parameters to the corresponding filter structure fields. lwa_filter-exedate = p_exedat. lwa_filter-exetime = p_exetim. lwa_filter-exe2date = p_exe2da. lwa_filter-exe2time = p_exe2ti. Move the others fields from the importing parameters to the corresponding fields. LOOP AT lt_filter REFERENCE INTO lr_moni_filter WHERE filternum = sy-index. CONCATENATE lc_filter lr_moni_filter->field INTO lv_fieldname. ASSIGN (lv_fieldname) TO <lfs_field>. IF sy-subrc = 0. <lfs_field> = lr_moni_filter->value. ENDIF. ENDLOOP.

* *

* *

* Select the messages log CALL FUNCTION 'SXMB_SELECT_MESSAGES_NEW' EXPORTING

im_filter = lwa_filter im_number = lc_number IMPORTING ex_msgtab = lt_msgtab_aux EXCEPTIONS persist_error = 1 missing_parameter = 2 negative_time_range = 3 too_many_parameters = 4 no_timezone = 5 OTHERS = 6. IF sy-subrc <> 0. "#EC NEEDED ENDIF. APPEND LINES OF lt_msgtab_aux TO lt_msgtab. ENDDO. FREE: lwa_filter, lwa_pids, lt_msgtab_aux, lv_times, lv_fieldname. * Process the retrieved data and return it to the function * caller. LOOP AT lt_msgtab REFERENCE INTO lr_msgtab. lwa_zsxmb_moni-msgguid = lr_msgtab->msgguid. lwa_zsxmb_moni-pid = lr_msgtab->pid. lwa_zsxmb_moni-ob_system = lr_msgtab->ob_system. lwa_zsxmb_moni-ob_ns = lr_msgtab->ob_ns. lwa_zsxmb_moni-ob_name = lr_msgtab->ob_name. lwa_zsxmb_moni-ib_system = lr_msgtab->ib_system. lwa_zsxmb_moni-ib_ns = lr_msgtab->ib_ns. lwa_zsxmb_moni-ib_name = lr_msgtab->ib_name. lwa_zsxmb_moni-msgtype = lr_msgtab->msgtype. lwa_zsxmb_moni-msgstate = lr_msgtab->msgstate. lwa_zsxmb_moni-exetimest = lr_msgtab->exetimest. lwa_zsxmb_moni-inittimest = lr_msgtab->inittimest. lwa_zsxmb_moni-sendtimest = lr_msgtab->sendtimest. lwa_zsxmb_moni-adminuser = lr_msgtab->adminuser. lwa_zsxmb_moni-rest_vers = lr_msgtab->rest_vers. lwa_zsxmb_moni-ref_to_msg = lr_msgtab->ref_to_msg. lwa_zsxmb_moni-rest_vers = lr_msgtab->rest_vers. lwa_zsxmb_moni-vers = lr_msgtab->vers. APPEND lwa_zsxmb_moni TO gt_zsxmb_moni. CLEAR lwa_zsxmb_moni. ENDLOOP. DELETE gt_zsxmb_moni WHERE ob_name NOT IN s_int AND ib_name NOT IN s_int. IF gt_zsxmb_moni IS INITIAL. * RAISE no_data. MESSAGE 'Message log data not found'(030) TYPE 'E' DISPLAY LIKE 'E'. ENDIF. ENDFORM. " MESSAGE_LOG_DATA_SELECTION *&---------------------------------------------------------------------* *& Form GET_APPERR *&---------------------------------------------------------------------* * get the corresponding response MSGUID and get the payload *----------------------------------------------------------------------* FORM get_apperr USING us_zsxmb_moni TYPE ty_zsxmb_moni uv_apperr TYPE string. DATA: lv_resp_guid TYPE sxmsmsglst-ref_to_msg, lwa_zsxmb_moni TYPE ty_zsxmb_moni. DATA: lit_errmsgs TYPE STANDARD TABLE OF string,

lit_errmsgs1 lit_errmsgs2 lwa_errmsgs lwa_errmsgs1 lwa_errmsgs2 lv_msg lv_lines

TYPE TYPE LIKE LIKE LIKE TYPE TYPE

STANDARD TABLE OF string, STANDARD TABLE OF string, LINE OF lit_errmsgs, LINE OF lit_errmsgs1, LINE OF lit_errmsgs2, string, sy-tfill. TYPE TYPE TYPE TYPE LIKE REF TO cl_xms_persist, REF TO if_xms_message , REF TO if_xms_message_xmb, sxms_mmfpayloads, LINE OF payload.

DATA : lr_persist_main lr_xms_msg_main lr_xmb_msg_main payload wa_payload DATA: lr_ixmlfactory lr_iparser lr_streamfactory lr_istream lr_idocument lv_name lv_value DATA: lv_payxstr * DATA :lr_lxml_root DATA:

TYPE REF TO if_ixml, TYPE REF TO if_ixml_parser, TYPE REF TO if_ixml_stream_factory, TYPE REF TO if_ixml_istream, TYPE REF TO if_ixml_document, TYPE string, TYPE string. TYPE xstring. TYPE REF TO if_ixml_node. TYPE TYPE TYPE TYPE TYPE TYPE TYPE TYPE TYPE REF REF REF REF REF REF REF REF REF TO TO TO TO TO TO TO TO TO if_ixml_node_list , if_ixml_node_iterator , if_ixml_node, if_ixml_node_list , if_ixml_node_iterator , if_ixml_node, if_ixml_node_list , if_ixml_node_iterator , if_ixml_node,

lr_lxml_rec_list lr_lxml_rec_iterator lr_lxml_rec_node lr_lxml_rec_child_list lr_lxml_rec_child_itertaor lr_lxml_rec_child_node lr_lxml_rec_child_list1 lr_lxml_rec_child_itertaor1 lr_lxml_rec_child_node1 lr_lxml_root

TYPE REF TO if_ixml_node.

lv_resp_guid = us_zsxmb_moni-msgguid. IF us_zsxmb_moni-msgtype = 'S'. uid. IF sy-subrc EQ 0. TRY. CREATE OBJECT lr_persist_main. CALL METHOD lr_persist_main->read_msg_all EXPORTING im_msgguid = lwa_zsxmb_moni-msgguid im_pid = lwa_zsxmb_moni-pid im_version = lwa_zsxmb_moni-rest_vers IMPORTING ex_message = lr_xms_msg_main. lr_xmb_msg_main ?= lr_xms_msg_main. CALL METHOD lr_xmb_msg_main->get_main_payloads RECEIVING return = payload. IF payload IS NOT INITIAL. READ TABLE payload INTO wa_payload INDEX 1. "Fetched the payload of XML ID TRY. "For Synchronous Messages

READ TABLE gt_zsxmb_moni INTO lwa_zsxmb_moni WITH KEY ref_to_msg = lv_resp_g

CALL METHOD wa_payload-mainpayload->getbinarycontent RECEIVING return = lv_payxstr. CATCH cx_xms_exception . "#EC NO_HANDLER CATCH cx_xms_system_error . "#EC NO_HANDLER ENDTRY. CLASS cl_ixml DEFINITION LOAD. lr_ixmlfactory = cl_ixml=>create( ). lr_streamfactory = lr_ixmlfactory->create_stream_factory( ). * ). lr_idocument = lr_ixmlfactory->create_document( ). lr_iparser = lr_ixmlfactory->create_parser( stream_factory = lr_streamfactory istream = lr_istream document = lr_idocument ). lr_iparser->parse( ). * start wiht the Root of XML document lr_lxml_root = lr_idocument->get_root_element( ). lv_name = lr_lxml_root->get_name( ). lv_value = lr_lxml_root->get_value( ). TRANSLATE lv_name TO UPPER CASE. IF lv_name EQ 'EXCEPTION'. SPLIT lv_value AT ';' INTO TABLE lit_errmsgs. LOOP AT lit_errmsgs INTO lwa_errmsgs. CLEAR: lit_errmsgs1, lit_errmsgs2. SPLIT lwa_errmsgs AT cl_abap_char_utilities=>newline INTO TABLE lit_errmsgs1. DESCRIBE TABLE lit_errmsgs1 LINES lv_lines. IF lv_lines GT 2. CONTINUE. ELSEIF lv_lines EQ 2. LOOP AT lit_errmsgs1 INTO lwa_errmsgs1. CLEAR: lit_errmsgs2. SPLIT lwa_errmsgs1 AT ':' INTO TABLE lit_errmsgs2. DESCRIBE TABLE lit_errmsgs2 LINES lv_lines. READ TABLE lit_errmsgs2 INTO lwa_errmsgs2 INDEX lv_lines. IF sy-subrc EQ 0. IF uv_apperr IS INITIAL. uv_apperr = lwa_errmsgs2 . ELSE. CONCATENATE uv_apperr lwa_errmsgs2 INTO uv_apperr. ENDIF. ENDIF. ENDLOOP. CONCATENATE LINES OF lit_errmsgs1 INTO lv_msg. IF uv_apperr IS INITIAL. uv_apperr = lv_msg. ELSE. CONCATENATE uv_apperr lv_msg INTO uv_apperr. ENDIF. CONTINUE. ENDIF. CLEAR: lit_errmsgs1, lit_errmsgs2. SPLIT lwa_errmsgs AT ':' INTO TABLE lit_errmsgs1. Create DOM lr_istream = lr_streamfactory->create_istream_xstring( lv_payxstr

DESCRIBE TABLE lit_errmsgs1 LINES lv_lines. READ TABLE lit_errmsgs1 INTO lwa_errmsgs1 INDEX lv_lines. IF sy-subrc EQ 0. IF uv_apperr IS INITIAL. uv_apperr = lwa_errmsgs1. ELSE. CONCATENATE uv_apperr lwa_errmsgs1 INTO uv_apperr. ENDIF. ENDIF. CLEAR: lit_errmsgs1, lit_errmsgs2. ENDLOOP. IF uv_apperr IS INITIAL. uv_apperr = lv_value. ENDIF. ENDIF. ENDIF. CATCH cx_xms_syserr_persist. "#EC NO_HANDLER ENDTRY. ENDIF. *** Added by Balaji 7/20/2013 ELSEIF us_zsxmb_moni-msgtype = 'A'. "For Assynchronous Messages IF us_zsxmb_moni-rest_vers NE us_zsxmb_moni-vers. * BREAK-POINT. TRY. CREATE OBJECT lr_persist_main. CALL METHOD lr_persist_main->read_msg_all EXPORTING im_msgguid = us_zsxmb_moni-msgguid im_pid = us_zsxmb_moni-pid im_version = us_zsxmb_moni-vers IMPORTING ex_message = lr_xms_msg_main. lr_xmb_msg_main ?= lr_xms_msg_main. CALL METHOD lr_xmb_msg_main->get_main_payloads RECEIVING return = payload. IF payload IS NOT INITIAL. READ TABLE payload INTO wa_payload INDEX 1. "Fetched the payload of XML ID TRY. CALL METHOD wa_payload-mainpayload->getbinarycontent RECEIVING return = lv_payxstr. CATCH cx_xms_exception . "#EC NO_HANDLER CATCH cx_xms_system_error . "#EC NO_HANDLER ENDTRY. CLASS cl_ixml DEFINITION LOAD. lr_ixmlfactory = cl_ixml=>create( ). lr_streamfactory = lr_ixmlfactory->create_stream_factory( ). * ). lr_idocument = lr_ixmlfactory->create_document( ). lr_iparser = lr_ixmlfactory->create_parser( stream_factory = lr_streamfactory istream = lr_istream document = lr_idocument ). Create DOM lr_istream = lr_streamfactory->create_istream_xstring( lv_payxstr

lr_iparser->parse( ). * start wiht the Root of XML document lr_lxml_root = lr_idocument->get_root_element( ). lv_name = lr_lxml_root->get_name( ). lv_value = lr_lxml_root->get_value( ). TRANSLATE lv_name TO UPPER CASE.

IF lv_name EQ 'ZCMN_FAULT_MSG'. lr_lxml_rec_list = lr_lxml_root->get_children( ). * lv_len = lr_lxml_rec_list->get_length( ). * break dikumar. lr_lxml_rec_iterator = lr_lxml_rec_list->create_iterator( ). "get all the records lr_lxml_rec_node = lr_lxml_rec_iterator->get_next( ). WHILE lr_lxml_rec_node IS NOT INITIAL. " Loop through RECORDS lr_lxml_rec_child_list = lr_lxml_rec_node->get_children( ). lr_lxml_rec_child_itertaor = lr_lxml_rec_child_list->create_iter ator( ). lr_lxml_rec_child_node = lr_lxml_rec_child_itertaor->get_next( ) . WHILE lr_lxml_rec_child_node IS NOT INITIAL. "loop through child en of RECORDS lv_name = lr_lxml_rec_child_node->get_name( ). lv_value = lr_lxml_rec_child_node->get_value( ). IF lv_name EQ 'faultText' AND lv_value NE space. CLEAR: lwa_errmsgs1. lwa_errmsgs1 = lv_value. APPEND lwa_errmsgs1 TO lit_errmsgs1. ENDIF. IF lv_name EQ 'faultDetail'. lr_lxml_rec_child_list1 = lr_lxml_rec_child_node->get_childr en( ). lr_lxml_rec_child_itertaor1 = lr_lxml_rec_child_list1->creat e_iterator( ). lr_lxml_rec_child_node1 = lr_lxml_rec_child_itertaor1->get_n ext( ). WHILE lr_lxml_rec_child_node1 IS NOT INITIAL. lv_name = lr_lxml_rec_child_node1->get_name( ). lv_value = lr_lxml_rec_child_node1->get_value( ). IF lv_name EQ 'text'. CLEAR: lwa_errmsgs1. lwa_errmsgs1 = lv_value. APPEND lwa_errmsgs1 TO lit_errmsgs1. EXIT. ENDIF. lr_lxml_rec_child_node1 = lr_lxml_rec_child_itertaor1->get ENDWHILE. ENDIF. BREAK-POINT. lr_lxml_rec_child_node = lr_lxml_rec_child_itertaor->get_next( ). * BREAK-POINT. ENDWHILE. lr_lxml_rec_node = lr_lxml_rec_iterator->get_next( ). ENDWHILE.

* _next( ). *

ENDIF. ENDIF. IF lit_errmsgs1[] IS NOT INITIAL. CLEAR: lwa_errmsgs1. READ TABLE lit_errmsgs1 INTO lwa_errmsgs1 INDEX lines( lit_errmsgs1 ). IF sy-subrc EQ 0. uv_apperr = lwa_errmsgs1. ENDIF. ENDIF. CATCH cx_xms_syserr_persist. ENDTRY. "#EC NO_HANDLER

ENDIF. ENDIF. ENDFORM. " GET_APPERR *&---------------------------------------------------------------------* *& Form SELECT_INTERFACE_NAME *&---------------------------------------------------------------------* FORM select_interface_name USING uv_int TYPE zinterface. * * TYPES: BEGIN OF lty_int, * zinterface TYPE zint_master-zinterface, * zdesc type zint_master-zdesc, * END OF lty_int. DATA : lt_int TYPE STANDARD TABLE OF zint_master, lv_int TYPE zinterface. DATA: lt_fieldtab TYPE TABLE OF dfies, lwa_fieldtab LIKE LINE OF lt_fieldtab. lv_int = uv_int. lwa_fieldtab-tabname = 'ZINT_MASTER'. lwa_fieldtab-fieldname = 'ZINTERFACE'. APPEND lwa_fieldtab TO lt_fieldtab. lwa_fieldtab-tabname = 'ZINT_MASTER'. lwa_fieldtab-fieldname = 'ZDESC'. APPEND lwa_fieldtab TO lt_fieldtab. SELECT * FROM zint_master INTO TABLE lt_int. * WHERE zinterface EQ lv_int. CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' EXPORTING retfield = 'ZINTERFACE' dynpprog = sy-repid dynpnr = sy-dynnr dynprofield = 'S_INT' value_org = 'P' TABLES value_tab = lt_int field_tab = lt_fieldtab[] EXCEPTIONS parameter_error = 1 no_values_found = 2

OTHERS = 3. IF sy-subrc <> 0. "#EC NEEDED * Implement suitable error handling here ENDIF. ENDFORM. " SELECT_INTERFACE_NAME *&---------------------------------------------------------------------* *& Form VALIDATE_INTERFACE *&---------------------------------------------------------------------* FORM validate_interface . TYPES:BEGIN OF lty_int, zinterface TYPE zinterface, END OF lty_int. DATA : lt_int TYPE STANDARD TABLE OF lty_int. SELECT zinterface FROM zint_master INTO TABLE lt_int WHERE zinterface IN s_int. IF sy-subrc NE 0. MESSAGE 'Enter valid interface name'(031) TYPE 'E' DISPLAY LIKE 'E'. ENDIF. ENDFORM. " VALIDATE_INTERFACE *&---------------------------------------------------------------------* *& Form F_GET_REC_COUNT *&---------------------------------------------------------------------* FORM f_get_rec_count USING uv_msgguid TYPE ty_zsxmb_moni-msgguid uv_pid TYPE ty_zsxmb_moni-pid uv_rest_vers TYPE ty_zsxmb_moni-rest_vers CHANGING cv_rec_count TYPE ty_zsxmb_moni-rec_count. DATA : lr_persist_main lt_payload lwa_payload lv_payxstr lv_len DATA: lr_xms_msg_main lr_xmb_msg_main DATA: lr_ixmlfactory lr_iparser lr_streamfactory lr_istream lr_idocument TYPE TYPE LIKE TYPE TYPE REF TO cl_xms_persist, sxms_mmfpayloads, LINE OF lt_payload, xstring, i.

TYPE REF TO if_xms_message, TYPE REF TO if_xms_message_xmb. TYPE TYPE TYPE TYPE TYPE REF REF REF REF REF TO TO TO TO TO if_ixml, if_ixml_parser, if_ixml_stream_factory, if_ixml_istream, if_ixml_document.

DATA: lr_lxml_root TYPE REF TO if_ixml_node, lr_lxml_rec_list TYPE REF TO if_ixml_node_list. CLEAR: lv_len. TRY. CREATE OBJECT lr_persist_main. CALL METHOD lr_persist_main->read_msg_all EXPORTING im_msgguid = uv_msgguid im_pid = uv_pid im_version = uv_rest_vers IMPORTING ex_message = lr_xms_msg_main. lr_xmb_msg_main ?= lr_xms_msg_main.

CALL METHOD lr_xmb_msg_main->get_main_payloads RECEIVING return = lt_payload. IF lt_payload IS NOT INITIAL. READ TABLE lt_payload INTO lwa_payload INDEX 1. "Fetched the payload of XML ID TRY. CALL METHOD lwa_payload-mainpayload->getbinarycontent RECEIVING return = lv_payxstr. CATCH cx_xms_exception . CATCH cx_xms_system_error . ENDTRY. "#EC NO_HANDLER "#EC NO_HANDLER

lr_ixmlfactory = cl_ixml=>create( ). lr_streamfactory = lr_ixmlfactory->create_stream_factory( ). * Create DOM lr_istream = lr_streamfactory->create_istream_xstring( lv_payxstr ). lr_idocument = lr_ixmlfactory->create_document( ). lr_iparser = lr_ixmlfactory->create_parser( stream_factory = lr_streamfactory istream = lr_istream document = lr_idocument ). lr_iparser->parse( ). lr_lxml_root = lr_idocument->get_root_element( ). lr_lxml_rec_list = lr_lxml_root->get_children( ). lv_len = lr_lxml_rec_list->get_length( ). ENDIF. CATCH cx_xms_syserr_persist. "#EC NO_HANDLER ENDTRY. cv_rec_count = lv_len. ENDFORM. " F_GET_REC_COUNT