Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Radio Buttons

Former Member
0 Kudos

Hi all,

I have two groups of radio buttons on my screen. While display the first radio button from both the groups gets selected by default. How to deselect the first button in teh second group when the screen gets displayed.

Pls help.

Aarthi.M

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

pls refer this code :

PARAMETERS: p_radio1 RADIOBUTTON GROUP g1 USER-COMMAND comm,

p_date1 TYPE sy-datum,

p_radio2 RADIOBUTTON GROUP g1 DEFAULT 'X',

p_date2 TYPE sy-datum.

AT SELECTION-SCREEN OUTPUT.

IF p_radio1 = 'X'.

LOOP AT SCREEN.

CASE screen-name.

WHEN 'P_DATE1'.

screen-input = '1'.

WHEN 'P_DATE2'.

screen-input = '0'.

ENDCASE.

MODIFY SCREEN.

ENDLOOP.

ELSEIF p_radio2 = 'X'.

LOOP AT SCREEN.

CASE screen-name.

WHEN 'P_DATE1'.

screen-input = '0'.

WHEN 'P_DATE2'.

screen-input = '1'.

ENDCASE.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

Hope it may be helpful to u.

regards,

Latheesh.

11 REPLIES 11

Former Member
0 Kudos

Hi Arathi,

In case you want only one button among several buttons to be active at one time, you have to assign all of those buttons to one radio button group.

Regards,

Aniket

Please award points if you find it helpful.

Former Member
0 Kudos

While creating you can specify "DEFAULT X" syntax to any one and always create a group for different set of radio buttons as

p_ckflcm TYPE c RADIOBUTTON GROUP rbl1 default 'X'.

If you do not want tomake any one default, use Checkbox instead.

Regards

Rohit

PS Reward points

Former Member
0 Kudos

Aarthi,

At any point of time, one radi button has to be active in both the groups. If you want to have specific button to be enabled you can set the default value X to that button.

You cannot have a case, where all the radio buttons in a group are unchecked.

Regards,

Ravi

Note : Please mark the helpful answers

Former Member
0 Kudos

Hi,

pls refer this code :

PARAMETERS: p_radio1 RADIOBUTTON GROUP g1 USER-COMMAND comm,

p_date1 TYPE sy-datum,

p_radio2 RADIOBUTTON GROUP g1 DEFAULT 'X',

p_date2 TYPE sy-datum.

AT SELECTION-SCREEN OUTPUT.

IF p_radio1 = 'X'.

LOOP AT SCREEN.

CASE screen-name.

WHEN 'P_DATE1'.

screen-input = '1'.

WHEN 'P_DATE2'.

screen-input = '0'.

ENDCASE.

MODIFY SCREEN.

ENDLOOP.

ELSEIF p_radio2 = 'X'.

LOOP AT SCREEN.

CASE screen-name.

WHEN 'P_DATE1'.

screen-input = '0'.

WHEN 'P_DATE2'.

screen-input = '1'.

ENDCASE.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

Hope it may be helpful to u.

regards,

Latheesh.

0 Kudos

Is this possible in dialog programming... not in selection screens ?

0 Kudos

YES

Code syntax is same

0 Kudos

Its possible both in dialog programming as well as on selection screens.

Regards,

Ravi

Note :Please mark the helpful answers

0 Kudos

hi

yes its possible..using the above code.

u will be grouping the radiobttons by specifying the the same group name in their propeties window.

hope this helps,

priya.

Former Member
0 Kudos

hi,

try this.

data: v_r1 type c,

v_r2 type c.

group these radiobuttons.

In PBO, v_r2 = 'X'.

Regards,

Sailaja.

0 Kudos

Hi ,

It is possible to select your own radio button .

Supposing that you have created 2 radio buttons RAD1 and RAD2 of the same group.

By default , RAD1 will be selected.

If you want RAD2 to be selected instead of RAD1,

1)Declare two variables

data: RAD1 type C,

RAD2 type C.

2) In PBO,

RAD1 = space.

RAD2 = 'X'.

That is it.

Hope your query is solved.

Regards,

SP.

0 Kudos

IF SCR1000-RAD1 = 'X'.

LOOP AT SCREEN.

CASE screen-name.

WHEN 'SCR1000-RAD2'.

screen-input = 0.

ENDCASE.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

I gave the above code and the button got deselected. But i am not able to select that button again.. What should be done for this..?

I tried with SCR1000-RAD2 = ' '. That too dint work.