My requirement is to have two radio buttons in the selection screen. Upon execution , the report should be called based on Radio button.
Without execution when back button is clicked , it still opens report1. Pressing key F3 or back is not as expected.
SELECTION-SCREEN BEGIN OF SCREEN 100 TITLE title.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
PARAMETER: ZREP_2 RADIOBUTTON GROUP rad DEFAULT 'X' USER-COMMAND frad,
ZREP_3 RADIOBUTTON GROUP rad . ##SEL_WRONG
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN END OF SCREEN 100.
CALL SELECTION-SCREEN '100'.
AT SELECTION-SCREEN OUTPUT.
* Toggle the selection screens based on radio buttons
LOOP AT SCREEN.
IF zrep_2 = 'X' AND screen-group1 = 'SC2'.
PERFORM modify_screen. "Calling subroutine
ELSEIF zrep_3 = 'X' AND screen-group1 = 'SC1'.
PERFORM modify_screen. "Calling subroutine
ENDIF.
ENDLOOP.
FORM modify_screen.
screen-active = 0.
MODIFY SCREEN.
ENDFORM.
START-OF-SELECTION.
CASE 'X'.
WHEN zrep_2.
SUBMIT zpp_scrap_report AND RETURN.
CALL SELECTION-SCREEN 100.
WHEN zrep_3.
SUBMIT zpp_scrap_report_material_doc AND RETURN.
CALL SELECTION-SCREEN 100.
ENDCASE.
There are several ways to fix this as Sandra said, you should thoroughly read help about selection screen events: what of them is PAI, what is PBO and what is difference between them.
In selscreen help you may find a concept about function codes, you need always check for function code when encapsulating some logic in the PAI selection screen events. In your case you gotta check for
CRETas you have custom selscreen, for standard ones it isONLI.Practical-wise, you can return to screen explicitly via
LEAVE TOfor making screen modifications like you do, it is more logical to use PBO event
AT SELECTION-SCREEN OUTPUTThis way is straightforward, but more beautiful is to get rid of custom selection screen at all, in this case you don't need any LEAVE TO and don't need explicit START-OF-SELECTION either