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: 

How to check whether a radiobutton in a screen is clicked

Former Member
0 Kudos

Hi All,

I have created two radiobuttons with screen painter and grouped them and given function- code for the group. In the program i want to check which radio button is clicked. I am not able to set Fcodes for each button differently. Can anyone help me how to do this.

Thanks and regards,

Kranthi.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

I tried with that code but it is giving the following error.

Field "STD" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement . . . . . . . . . .

Here 'STD' is the radio button name.

Thanks and regards,

Kranthi.

8 REPLIES 8

Former Member
0 Kudos

can you post that part of code??

JozsefSzikszai
Active Contributor
0 Kudos

quite simple:

CASE 'X'.
WHEN rb1.
==> first radiobutton is clicked
WHEN rb2.
==> second radiobutton is clicked
ENDCASE.

raymond_giuseppi
Active Contributor
0 Kudos

The function code must be the same, so check the value when processing the code.

(...)
PARAMETERS p1 RADIOBUTTON GROUP grp USER-COMMAND opt.
PARAMETERS p2 RADIOBUTTON GROUP grp.
(...)
AT SELECTION-SCREEN.
  CASE sscrfields-ucomm.
    WHEN 'OPT'.
      IF p1 EQ 'X'.
        " process p1
      ELSEIF p2 EQ 'X'.
        " process p2
      ENDIF.
  ENDCASE.
(...)

Adapt the logic in PBO with dynpro. (If OK_CODE is the FC of the group, then check individual values of the radiobuttion of the group)

Regards

Former Member
0 Kudos

Hi,

You must have given the name to each Radio button say Radio1 and Radio2. Use that name.

IF radio1 = 'X'.

....your code.

ELSEIF radio2 = 'X'.

....your code.

ENDIF.

Regards,

Nadim

Former Member
0 Kudos

Hi,

I tried with that code but it is giving the following error.

Field "STD" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement . . . . . . . . . .

Here 'STD' is the radio button name.

Thanks and regards,

Kranthi.

0 Kudos

actually it is not clear, to whom do you answer, but the radiobuttons have to exist as global variables in the program:

DATA : rb1 TYPE c...

(with same name like on the screen!)

Former Member
0 Kudos

Hi,

In the Attributes of your radio button DO NOT check the checkbox 'From Dict'. Define it as CHAR type only. It should work fine then.

Regards,

Nadim

Former Member
0 Kudos

Hi Eric,

You solved my problem. After defining radiobuttons as character it is working.

Thanks a lot.

Kranthi.