In this short code snippet you can find out how to add additional buttons to the selection screen and trigger user-defined functions based on what user clicks on.
This specific example shows how to display current report’s documentation.
Note: The INFO button is added to the selection screen automatically once you maintain the report’s documentation, but the following code should serve as a reference on how a similar thing can be done manually.
* this is a must for 'sscrfields' definition TABLES sscrfields. * this is a must in case you want to use icons TYPE-POOLS icon. DATA: gs_functxt TYPE smp_dyntxt. SELECTION-SCREEN FUNCTION KEY 1. " here you can use 1-5 PARAMETERS: p_dummy TYPE matnr. INITIALIZATION. gs_functxt-icon_id = icon_information. gs_functxt-quickinfo = 'Report Documentation'(s01). gs_functxt-icon_text = 'Info'(s02). sscrfields-functxt_01 = gs_functxt. AT SELECTION-SCREEN. IF sscrfields-ucomm = 'FC01'. " show report documentation CALL FUNCTION 'DSYS_SHOW_FOR_F1HELP' EXPORTING dokclass = 'RE' dokname = sy-repid short_text = 'X' EXCEPTIONS class_unknown = 1 object_not_found = 2 OTHERS = 3. ENDIF. START-OF-SELECTION.
The result will look like the following picture: