Requirement : We have total 6 radio button in the below program. we want to show radio button based upon the RB1 and RB2.
Total radio buttons are - RB1, RB2, RB3, RB4, RB5, RB6.
When we click RB1 then RB3 and RB4 radio button will show, RB5 and RB6 will be hidden.
When we click RB2 then RB5 and RB6 radio button will show, RB3 and RB4 will be hidden.
Code :
REPORT ZVP_RADIO_BUTTON_DYNAMIC.
SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-100.
PARAMETERS: RB1 RADIOBUTTON GROUP RBG DEFAULT 'X' USER-COMMAND COMM,
RB2 RADIOBUTTON GROUP RBG.
SELECTION-SCREEN: BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-001.
PARAMETERS: RB3 RADIOBUTTON GROUP RBG1 MODIF ID MD1,
RB4 RADIOBUTTON GROUP RBG1 MODIF ID MD1.
SELECTION-SCREEN: END OF BLOCK B2.
SELECTION-SCREEN: BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-102.
PARAMETERS: RB5 RADIOBUTTON GROUP RBG2 MODIF ID MD2,
RB6 RADIOBUTTON GROUP RBG2 MODIF ID MD2.
SELECTION-SCREEN: END OF BLOCK B3.
SELECTION-SCREEN: END OF BLOCK B1.
AT SELECTION-SCREEN OUTPUT.
IF RB1 = 'X'.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'MD1'.
SCREEN-ACTIVE = 1.
MODIFY SCREEN.
ELSEIF SCREEN-GROUP1 = 'MD2'.
SCREEN-ACTIVE = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'MD1'.
SCREEN-ACTIVE = 0.
MODIFY SCREEN.
ELSEIF SCREEN-GROUP1 = 'MD2'.
SCREEN-ACTIVE = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
IDE Used To Test This Code : ABAP Editor.
Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.
Total radio buttons are - RB1, RB2, RB3, RB4, RB5, RB6.
When we click RB1 then RB3 and RB4 radio button will show, RB5 and RB6 will be hidden.
When we click RB2 then RB5 and RB6 radio button will show, RB3 and RB4 will be hidden.
Code :
REPORT ZVP_RADIO_BUTTON_DYNAMIC.
SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-100.
PARAMETERS: RB1 RADIOBUTTON GROUP RBG DEFAULT 'X' USER-COMMAND COMM,
RB2 RADIOBUTTON GROUP RBG.
SELECTION-SCREEN: BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-001.
PARAMETERS: RB3 RADIOBUTTON GROUP RBG1 MODIF ID MD1,
RB4 RADIOBUTTON GROUP RBG1 MODIF ID MD1.
SELECTION-SCREEN: END OF BLOCK B2.
SELECTION-SCREEN: BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-102.
PARAMETERS: RB5 RADIOBUTTON GROUP RBG2 MODIF ID MD2,
RB6 RADIOBUTTON GROUP RBG2 MODIF ID MD2.
SELECTION-SCREEN: END OF BLOCK B3.
SELECTION-SCREEN: END OF BLOCK B1.
AT SELECTION-SCREEN OUTPUT.
IF RB1 = 'X'.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'MD1'.
SCREEN-ACTIVE = 1.
MODIFY SCREEN.
ELSEIF SCREEN-GROUP1 = 'MD2'.
SCREEN-ACTIVE = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'MD1'.
SCREEN-ACTIVE = 0.
MODIFY SCREEN.
ELSEIF SCREEN-GROUP1 = 'MD2'.
SCREEN-ACTIVE = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
IDE Used To Test This Code : ABAP Editor.
Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.
Post a Comment