* ________ _______ _____ ___ ________ ______ _______ ________ * /" )/" "|(\" \|" \ /" ) / " \ /" \ /" ) * (: \___/(: ______)|.\\ \ |(: \___/ // ____ \ |: |(: \___/ * \___ \ \/ | |: \. \\ | \___ \ / / ) :)|_____/ ) \___ \ * __/ \\ // ___)_ |. \ \. | __/ \\(: (____/ // // / __/ \\ * /" \ :)(: "|| \ \ | /" \ :)\ / |: __ \ /" \ :) * (_______/ \_______) \___|\____\)(_______/ \"_____/ |__| \___)(_______/ * The always up-to-date overview for system-wide health monitoring * Report : zsensor_fxr_template. * Title : Automatically perform sensor followup - template report * Description : "! This report can be used when creating a new sensor fixer report. . REPORT zsensor_fxr_template. CLASS lcl_controller DEFINITION. PUBLIC SECTION. * ██ ██ Data definitions and logic to capture information from the source sensor and act on it. * ██ ██ data gt_sensor_data type zcl_sensor_manager=>gty_columns_tab. "! To fetch sensor long text settings (example only, not required) methods get_sensor_settings importing iv_sensortype type zsensors-sensor. "! 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. ENDCLASS. CLASS lcl_controller IMPLEMENTATION. METHOD get_sensor_settings. "Example coding only DATA lv_label TYPE string. DATA lv_value TYPE string. 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. METHOD get_sensor_data. "Example coding only 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. 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 * ██ ██ Fill in additional selection screen matters here. * ██ ██ PARAMETERS pa_more type char20 default 'Snowcones'. * ██ ██ * ██ ██ * ██ ██ 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 * ██ ██ If you want the multi-language setup through internationalization to be used * ██ ██ add the test elements you need here * ██ ██ * ██ ██ go_fixer->go_i18n->feed( VALUE #( * ██ ██ ( id = 'P05' nl = |Toon selectie scherm| en = |Show selection screen| ) * ██ ██ ( id = 'S01' nl = |Status| en = |Status| ) * ██ ██ ( id = 'HINT' nl = |The sort of mandatory hint| en = |Die sort von muss-haben hint| ) * ██ ██ ) ). * ██ ██ Supply texts for your own added selection screen fields. * ██ ██ lbl_p05 = go_fixer->go_i18n->get( 'P05' ). * ██ ██ lbl_s01 = go_fixer->go_i18n->get( 'S01' ). 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 data(go_control) = new lcl_controller( ). go_control->get_sensor_settings( pa_senso ). * ██ ██ Apply your logic here, directly or by capturing it in methods on gt_control. * ██ ██ Note that progress can be logged using go_fixer->log( 'Your progress message' ). * ██ ██ Note that a go_fixer class reference can also be made available on the go_control * ██ ██ class - to cater for logging from the go_control methods. "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