* ________ _______ _____ ___ ________ ______ _______ ________ * /" )/" "|(\" \|" \ /" ) / " \ /" \ /" ) * (: \___/(: ______)|.\\ \ |(: \___/ // ____ \ |: |(: \___/ * \___ \ \/ | |: \. \\ | \___ \ / / ) :)|_____/ ) \___ \ * __/ \\ // ___)_ |. \ \. | __/ \\(: (____/ // // / __/ \\ * /" \ :)(: "|| \ \ | /" \ :)\ / |: __ \ /" \ :) * (_______/ \_______) \___|\____\)(_______/ \"_____/ |__| \___)(_______/ * The always up-to-date overview for system-wide health monitoring * Report : zsensor_fxr_saver_SPOOL. * Title : Automatically perform Spool Request cleanup (FIXER) * Description : "! This report runs checks the state and settings on the SAVER_SPOOL "! sensor and follows up on it - by executing standard SAP cleanup "! report calls. REPORT zsensor_fxr_saver_SPOOL. CLASS lcl_controller DEFINITION. PUBLIC SECTION. TYPES: BEGIN OF lty_settings, object TYPE c LENGTH 20, days TYPE int4, "Number of days retention period autofix TYPE c LENGTH 10, END OF lty_settings. CLASS-DATA gt_settings TYPE SORTED TABLE OF lty_settings WITH UNIQUE KEY object. CLASS-METHODS get_sensor_settings IMPORTING iv_sensortype TYPE zsensors-sensor. ENDCLASS. CLASS lcl_controller IMPLEMENTATION. METHOD get_sensor_settings. DATA lv_label TYPE string. DATA lv_value TYPE string. * Get the test settings for the sensor - focus on the AUTOFIX parameter and gather details. LOOP AT zcl_sensor_manager=>get_longtext( iv_sensortype = iv_sensortype ) INTO DATA(ls_textline). IF ls_textline-tdformat = '/:'. SPLIT ls_textline-tdline AT ':' INTO lv_label lv_value. READ TABLE gt_settings ASSIGNING FIELD-SYMBOL() WITH KEY object = ls_textline-tdline. IF sy-subrc <> 0. INSERT VALUE #( object = ls_textline-tdline ) INTO TABLE gt_settings ASSIGNING . ENDIF. ELSE. SPLIT ls_textline-tdline AT ':' INTO lv_label lv_value. CASE lv_label. WHEN 'DAYS'. MOVE lv_value TO -days. WHEN 'AUTOFIX'. MOVE lv_value TO -autofix. ENDCASE. ENDIF. ENDLOOP. 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 TABLES sood. SELECTION-SCREEN BEGIN OF BLOCK b02 WITH FRAME TITLE lbl_b02. "fixer base code SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN POSITION 2. PARAMETERS pa_viase AS CHECKBOX DEFAULT abap_true. SELECTION-SCREEN COMMENT 10(30) lbl_p05 FOR FIELD pa_viase. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN SKIP. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN POSITION 2. PARAMETERS pa_age1 AS CHECKBOX DEFAULT abap_true. SELECTION-SCREEN COMMENT 10(30) lbl_x01 FOR FIELD pa_age1. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN POSITION 2. PARAMETERS pa_age2 AS CHECKBOX DEFAULT abap_true. SELECTION-SCREEN COMMENT 10(30) lbl_x02 FOR FIELD pa_age2. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN POSITION 2. PARAMETERS pa_age3 AS CHECKBOX DEFAULT abap_true. SELECTION-SCREEN COMMENT 10(30) lbl_x03 FOR FIELD pa_age3. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN POSITION 2. PARAMETERS pa_age4 AS CHECKBOX DEFAULT abap_true. SELECTION-SCREEN COMMENT 10(30) lbl_x04 FOR FIELD pa_age4. SELECTION-SCREEN END OF LINE. 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_true "fixer base code - please adapt iv_hide_parvalue = abap_true ). "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( ). "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 = 'P05' nl = |Toon selectie scherm| en = |Show selection screen| ) ( id = 'X01' nl = |Zonder uitvoeropdracht| en = |...| ) ( id = 'X02' nl = |In bewerking| en = |...| ) ( id = 'X03' nl = |Afgedrukte| en = |...| ) ( id = 'X04' nl = |Foutieve| en = |...| ) ( id = 'HINT' nl = |Rapportage RSPO1041 zal worden aangeroepen| en = |Report RSPO1041 will be called| ) ( id = 'MSG1' nl = |BCS documenten & met periode & dagen wordt verwerkt| en = |BCS documents & met retention period & days is processed| ) ( id = 'MSG2' nl = |Rapportage & is aangeroepen| en = |Report & is called| ) ( id = 'MSG3' nl = |Afgerond| en = |Finished| ) ) ). lbl_p05 = go_fixer->go_i18n->get( 'P05' ). lbl_x01 = go_fixer->go_i18n->get( 'X01' ). lbl_x02 = go_fixer->go_i18n->get( 'X02' ). lbl_x03 = go_fixer->go_i18n->get( 'X03' ). lbl_x04 = go_fixer->go_i18n->get( 'X04' ). 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 "Open the measurements on relevant tables DATA(lo_measurements) = NEW zcl_sensors_grip_on_space( ). lo_measurements->table_measurement_start( VALUE #( ( 'TSP01' ) ( 'TSP02' ) ) ). ENDIF. lcl_controller=>get_sensor_settings( pa_senso ). LOOP AT lcl_controller=>gt_settings INTO DATA(ls_settings) WHERE autofix = zcl_sensors_grip_on_space=>co_certified. go_fixer->log( go_fixer->go_i18n->get( iv_id = 'MSG1' iv_par = ls_settings-object iv_par2 = |{ ls_settings-days }| ) ). IF pa_test = abap_false. go_fixer->log( go_fixer->go_i18n->get( iv_id = 'MSG2' iv_par = 'RSPO1041' ) ). IF pa_viase = space. SUBMIT rspo1041 WITH age1 = pa_age1 WITH min_alt1 = ls_settings-days WITH old1 = abap_true WITH age2 = pa_age2 WITH min_alt2 = ls_settings-days WITH old2 = abap_true WITH age3 = pa_age3 WITH min_alt3 = ls_settings-days WITH old3 = abap_true WITH age4 = pa_age4 WITH min_alt4 = ls_settings-days WITH old4 = abap_true AND RETURN. ELSE. SUBMIT rspo1041 WITH age1 = pa_age1 WITH min_alt1 = ls_settings-days WITH old1 = abap_true WITH age2 = pa_age2 WITH min_alt2 = ls_settings-days WITH old2 = abap_true WITH age3 = pa_age3 WITH min_alt3 = ls_settings-days WITH old3 = abap_true WITH age4 = pa_age4 WITH min_alt4 = ls_settings-days WITH old4 = abap_true VIA SELECTION-SCREEN AND RETURN. ENDIF. go_fixer->log( go_fixer->go_i18n->get( 'MSG3' ) ). ENDIF. ENDLOOP. IF sy-subrc <> 0. go_fixer->log( go_fixer->go_i18n->get( 'NODATA' ) ). ELSEIF pa_test = abap_false. lo_measurements->table_measurement_finish( ). 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