* ________ _______ _____ ___ ________ ______ _______ ________ * /" )/" "|(\" \|" \ /" ) / " \ /" \ /" ) * (: \___/(: ______)|.\\ \ |(: \___/ // ____ \ |: |(: \___/ * \___ \ \/ | |: \. \\ | \___ \ / / ) :)|_____/ ) \___ \ * __/ \\ // ___)_ |. \ \. | __/ \\(: (____/ // // / __/ \\ * /" \ :)(: "|| \ \ | /" \ :)\ / |: __ \ /" \ :) * (_______/ \_______) \___|\____\)(_______/ \"_____/ |__| \___)(_______/ * The always up-to-date overview for system-wide health monitoring * Report : zsensor_fxr_srt_moni. * Title : Automatic resend of webserver failed messages * Description : "! This report can be used when creating a new sensor fixer report. . REPORT zsensor_fxr_srt_moni. CLASS lcl_controller DEFINITION. PUBLIC SECTION. DATA go_fixer TYPE REF TO zcl_sensor_fixer. DATA gt_sensor_data TYPE zcl_sensor_manager=>gty_columns_tab. DATA gv_parvalue TYPE zsensors-parvalue. "! To execute a sensor and retrieve it's results into gt_sensor_data (example only, not required) METHODS get_sensor_data IMPORTING iv_sensor TYPE zsensors-sensor iv_groupname TYPE zsensors-groupname iv_parvalue TYPE zsensors-parvalue. METHODS mass_restart. ENDCLASS. CLASS lcl_controller IMPLEMENTATION. METHOD get_sensor_data. zcl_sensor_manager=>bapi_execute_sensor( EXPORTING is_sensor_defaults = VALUE zsensors( sensor = iv_sensor groupname = iv_groupname parvalue = iv_parvalue ) IMPORTING et_alv_data = gt_sensor_data ). ENDMETHOD. METHOD mass_restart. DATA lo_restarter TYPE REF TO cl_soap_util_mass_restart. DATA lt_restart_messages TYPE srt_persistency_access_id_t. LOOP AT gt_sensor_data INTO DATA(ls_sensor_data). select location from SRT_MMASTER into @data(lv_location) where message_id = @ls_sensor_data-c1. endselect. APPEND VALUE #( message_id = ls_sensor_data-c1 location = lv_location ) TO lt_restart_messages. ENDLOOP. TRY. CREATE OBJECT lo_restarter. lo_restarter->restart_messages( it_access_ids = lt_restart_messages ). CATCH cx_soap_area_seq cx_wsm_access_authority. go_fixer->log( 'Authorisation missing (restart)' ). EXIT. ENDTRY. go_fixer->log( |Restart for { lines( lt_restart_messages ) } messages completed| ). ENDMETHOD. ENDCLASS. SELECTION-SCREEN BEGIN OF BLOCK b01 WITH FRAME TITLE lbl_b01. "fixer base code SELECTION-SCREEN BEGIN OF LINE. "fixer base code SELECTION-SCREEN COMMENT 1(30) lbl_p01 FOR FIELD pa_senso. "fixer base code PARAMETERS pa_senso TYPE zsensors-sensor DEFAULT sy-repid+12. "fixer base code PARAMETERS pa_sentx TYPE char60. "fixer base code SELECTION-SCREEN END OF LINE. "fixer base code SELECTION-SCREEN BEGIN OF LINE. "fixer base code SELECTION-SCREEN COMMENT 1(30) lbl_p02 FOR FIELD pa_group. "fixer base code PARAMETERS pa_group TYPE zsensors-groupname. "fixer base code PARAMETERS pa_groux TYPE char60. "fixer base code SELECTION-SCREEN END OF LINE. "fixer base code SELECTION-SCREEN BEGIN OF LINE. "fixer base code SELECTION-SCREEN COMMENT 1(30) lbl_p03 FOR FIELD pa_parva. "fixer base code PARAMETERS pa_parva TYPE zsensors-parvalue. "fixer base code SELECTION-SCREEN END OF LINE. "fixer base code SELECTION-SCREEN SKIP. "fixer base code SELECTION-SCREEN BEGIN OF LINE. "fixer base code SELECTION-SCREEN POSITION 2. "fixer base code PARAMETERS pa_test AS CHECKBOX DEFAULT abap_true. "fixer base code SELECTION-SCREEN COMMENT 10(30) lbl_p04 FOR FIELD pa_test. "fixer base code SELECTION-SCREEN END OF LINE. "fixer base code SELECTION-SCREEN END OF BLOCK b01. "fixer base code SELECTION-SCREEN BEGIN OF BLOCK b02 WITH FRAME TITLE lbl_b02. "fixer base code SELECTION-SCREEN BEGIN OF LINE. "fixer base code SELECTION-SCREEN COMMENT 2(60) lbl_hint. "fixer base code SELECTION-SCREEN END OF LINE. "fixer base code SELECTION-SCREEN END OF BLOCK b02. "fixer base code AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_group. "fixer base code pa_group = zcl_sensor_manager=>value_request_group( ). "fixer base code AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_parva. "fixer base code pa_parva = zcl_sensor_manager=>value_request_sensorparvalues( iv_sensor = pa_senso ). "fixer base code AT SELECTION-SCREEN OUTPUT. * ## ## When groupname and parameter value are not required, just disable the fields * ## ## here. Fixer reports should have a uniform look-and-feel. zcl_sensor_fixer=>at_screen_output( "fixer base code iv_hide_group = abap_false "fixer base code - please adapt iv_hide_parvalue = abap_false ). "fixer base code - please adapt pa_groux = zcl_sensor_manager=>get_name_group( pa_group ). "fixer base code INITIALIZATION. DATA(go_fixer) = zcl_sensor_fixer=>get_instance( ). "fixer base code "Label fields for the top-selection (the same for all fixer reports) "fixer base code lbl_b01 = go_fixer->go_i18n->get( 'B01_main' ). "fixer base code lbl_p01 = go_fixer->go_i18n->get( 'P01_sensor' ). "fixer base code lbl_p02 = go_fixer->go_i18n->get( 'P02_group' ). "fixer base code lbl_p03 = go_fixer->go_i18n->get( 'P03_parametervalue' ). "fixer base code lbl_p04 = go_fixer->go_i18n->get( 'P04_test' ). "fixer base code lbl_b02 = go_fixer->go_i18n->get( 'B02_extra' ). "fixer base code go_fixer->go_i18n->feed( VALUE #( ( id = 'HINT' nl = |CL_SOAP_UTIL_MASS_RESTART wordt aangeroepen om aangegeven berichten te herstarten| en = |CL_SOAP_UTIL_MASS_RESTART is called to restart selected messages| ) ( id = 'NOTHING2DO' nl = |Geen gegevens gevonden (sensor leeg of niet voorhanden)| en = |No data found (sensor emplty or unavailable)| ) ( id = 'DATAOK' nl = |Gegevens gevonden (& sensor resultaten beschikbaar)| en = |Data found (& sensor results available)| ) ( id = 'NOTCERTIFIED' nl = |Sensor niet geschikt (certified) voor autofix (controleer parameter)| en = |Sensor not certified for autofix (check parameter)| ) ) ). lbl_hint = go_fixer->go_i18n->get( 'HINT' ). "fixer base code "Set the sensor description "fixer base code pa_sentx = zcl_sensor_manager=>gt_sensortype_detail[ sensor = pa_senso ]-summary. "fixer base code START-OF-SELECTION. IF pa_test = abap_true. "fixer base code go_fixer->log( go_fixer->go_i18n->get( 'TESTMODE' ) ). "fixer base code ELSE. "fixer base code IF NOT go_fixer->enqueue_run( ). "fixer base code EXIT. "fixer base code ENDIF. "fixer base code ENDIF. "fixer base code if pa_parva cs 'AUTO:Y' or pa_parva cs 'AUTO:CERTIFIED'. DATA(go_control) = NEW lcl_controller( ). go_control->get_sensor_data( iv_sensor = pa_senso iv_groupname = pa_group iv_parvalue = pa_parva ). "Clear irrelevant lines from the sensor results loop at go_control->gt_sensor_data into data(ls_sensor_data). if ls_sensor_data-c2 is initial. delete go_control->gt_sensor_data. endif. endloop. IF lines( go_control->gt_sensor_data ) = 0. go_fixer->log( go_fixer->go_i18n->get( 'NOTHING2DO' ) ). ELSE. go_fixer->log( go_fixer->go_i18n->get( iv_id = 'DATAOK' iv_par = |{ lines( go_control->gt_sensor_data ) }| ) ). go_control->go_fixer = go_fixer. go_control->gv_parvalue = pa_parva. IF pa_test = abap_false. go_control->mass_restart( ). ENDIF. ENDIF. else. go_fixer->log( go_fixer->go_i18n->get( 'NOTCERTIFIED' ) ). endif. "Conclusion of the fixer run - dequeue and report logged messages "fixer base code go_fixer->dequeue_run( ). "fixer base code go_fixer->log_display( ). "fixer base code