Sometimes we want to run reports only in background due to performance issues or some other reasons. Here we are trying to deactivate the EXECUTE option altogether so that the user has to use background option only.
Function module RS_SET_SELSCREEN_STATUS can be used to exclude any function codes from customized or standard GUI status on selection screen.
‘ONLI’ is the function code attached to the EXECUTE option. We can deactivate this option using the following code.
DATA: gv_ucomm TYPE sy-ucomm. DATA: gt_ucomm TYPE TABLE OF sy-ucomm. PARAMETERS: p_name(10). AT SELECTION-SCREEN OUTPUT. gv_ucomm = 'ONLI'. APPEND gv_ucomm TO gt_ucomm. CLEAR gv_ucomm. CALL FUNCTION 'RS_SET_SELSCREEN_STATUS' EXPORTING p_status = sy-pfkey * P_PROGRAM = ' ' TABLES p_exclude = gt_ucomm. START-OF-SELECTION. WRITE: 'Hello ', p_name.
Run the report to see the EXECUTE button removed from the application toolbar in the selection screen.
Also the menu path Program->Execute is disabled.