Application Development and Automation 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: 
Read only

Radiobutton: clear default selection

Former Member
0 Likes
2,841

Hi,

I have two blocks in my selection screen. two of them have a group of radiobuttons. when I executed the selection screen first radiobutton of each group are selected default, which is true. but my requirement is show the 1st radiobutton of the 2nd group not selected initially. I know it is trickey. I think it is not possible, please let me know your comments. If required more information, please let me know.

thank you,

surya

4 REPLIES 4
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,266

Within a radiobutton group, exactly one radiobutton must be set on. You can not have a radiobutton group which has no default. It is simply not possible in ABAP.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
1,266

Why not use checkboxes instead?

rob

Read only

0 Likes
1,266

Exactly, you can simulate the radiobutton functionality using checkboxes and when using checkboxes, no default is required. See the example.



REPORT zrich_0001.



PARAMETERS: p_check1 AS CHECKBOX USER-COMMAND check,
            p_check2 AS CHECKBOX USER-COMMAND check,
            p_check3 AS CHECKBOX USER-COMMAND check.

DATA: cursorfield(20) TYPE c.

AT SELECTION-SCREEN.


  GET CURSOR FIELD cursorfield.

  IF cursorfield = 'P_CHECK1'.
    p_check2 = space.
    p_check3 = space.
  ELSEIF  cursorfield = 'P_CHECK2'.
    p_check1 = space.
    p_check3 = space.
  ELSEIF cursorfield = 'P_CHECK3'.
    p_check1 = space.
    p_check2 = space.
  ENDIF.

Regards,

RIch Heilman

Read only

Former Member
0 Likes
1,266

Hi Surya,

One way could be you can hide the unselected second selection block.

two selection block a01 and a02. There are two radio button (p_r1, p_r2) in a1.

If p_r1 is choosed, selection block a02 is not  displayed; 
if p_r2 is choosed, selection block a02 is  displayed.

selection-screen: begin of block a01 with frame.
parameters: p_r1 radiobutton group rg1 default 'X' user-command uc,               
                  p_r2 radiobutton group rg1.
selection-screen: end of block a01.
 
selection-screen: begin of block a02 with frame.
selection-screen: begin of line,
pushbutton 33(20) selp user-command sel modif id chk ,
comment 55(13) selcnt  modif id chk,
end of line.
*SELECTION-SCREEN: SKIP.
parameters: p_count type i  modif id chk .
selection-screen: end of block a02.
 
 
at selection-screen output.
 
  if p_r1 = 'X'.
    loop at screen .
      if screen-group1 = 'CHK'.
        screen-active = 0.
        modify screen.
      endif.
    endloop.
  endif.

Reward points if found helpful

Revert back for more help

Regards

Naresh