Wednesday, April 13, 2011

Radio Button ( Toggle) on selection screen

This program helps to maintain selection screen based on Radio button selection.

When we have two radio buttons on the selection screen and while selecting the first button only few fields should display. Rest fields should be hidden.



A Simple program logic is given as below.

First create radio button with user command.
Then create selection screen fields with modification id numbers.

After this event 'At Selection Screen On Output' is called to display the fields based on radio button selection.

TABLES: mara.
TABLES sscrfields.


PARAMETERS : rb_one RADIOBUTTON GROUP rb1
USER-COMMAND xyz
DEFAULT 'X',
rb_two RADIOBUTTON GROUP rb1.

selection-screen begin of block b1 with frame .
PARAMETERS: p_file TYPE rlgrap-filename MODIF ID id1.
SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME.
SELECT-OPTIONS: s_mara FOR mara-matnr MODIF ID id2,
s_date FOR sy-datum MODIF ID id2.
SELECTION-SCREEN END OF BLOCK b2.


AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF rb_one EQ 'X'.
IF screen-group1 = 'ID1'.
* screen-required = 1.
screen-active = 1.
MODIFY SCREEN.
ENDIF.
ELSEIF rb_two EQ 'X'.
IF screen-group1 = 'ID2'.
screen-active = 0.
MODIFY SCREEN.
ENDIF..

ENDIF.
ENDLOOP.

No comments:

Post a Comment