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: 

loop at screen, radio button value????

Former Member
0 Kudos

hi. Can someone tell me how can i get the value of a radio button when loopin at screen?? i have a radio group with 3 radio button bu i cant get teh one that was selected..

Thk, Regards

12 REPLIES 12

former_member181962
Active Contributor
0 Kudos

Hi ,

For the RB that is selected, the value will bbe 'X'.

if rb1, rb2 and rb3 are the radio buttons, then one of them at a time will be 'X'.

rb1 = 'X' if the first radio is selected.

Regards,

ravi

0 Kudos

my problem is that was a screen made by the layout... when i loop at screen the screen name brings teh name of the radio buttons but not the table screen doesn bring the value, if its selected or no...

Thk for the reply,

Regards

0 Kudos

The SCREEN internal table doesn't hold the values of the radio-button or screen fields.

You can directly use the name of the radio-button to get its value.

0 Kudos

You do not need to LOOP at screen to get the value of the radiobutton at runtime. Just do a simply IF statement or CASE statement like I've suggested above.

Radiobuttons are just like any other input field in your layout, single character field which has a value of space or 'X'. That's it.

Regards,

Rich Heilman

0 Kudos

THK GUYS!! i made, but now my question is if can i return a value from the screen..

The choice of the user and then return it. in the pai module i can see the radio checked but how to say to the program that calls the screen wich choice was made??

Thk to all Regards

0 Kudos

See my note above about creating global RB1, RB2 variables.

0 Kudos

WHen you create screen elements like input fields of radiobuttons, you always define the variable in the program with the same name. This variable will always have the most current value from the screen. There is no need to pass anything between the screen and the program, it just magically is mapped based on the screen field name and the matching variable(defined by a DATA statement) in your program. Is it clear?

Regards,

Rich HEilman

Former Member
0 Kudos

Hi joao,

Please verify the radio groups that you have entered for each radio button.

Thanks and regards

Vipin Das

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

The value will be "X". All you need to do is check the field for the value.

If p_rad1 = 'X'.
* Do something
elseif p_rad2 = 'X'.
* Do something
elseif p_rad3 =  'X'.
* Do something
endif.

Regards,

RIch Heilman

0 Kudos

You could also do this with a CASE statement, although this kind of programming is a little sloppy.

case 'X'.

  when p_rad1.
* Do Something
  when p_rad2.
* Do Something
  when p_rad3.
* Do Something
endcase.

Regards,

RIch Heilman

Former Member
0 Kudos

Joao,

In dialog program, these 3 radio buttons MUST have data declarations in the TOP INCLUDE that is GLOBAL.

In addition, the names of the radio buttons in the Screen Painter MUST match EXACTLY the names created in the TOP INCLUDE.

Ex: In screen painter, create a Radio Buttons called RB1 and RB2.

In the TOP Include, there MUST be a data statements like this:

data: RB1(1).

data: RB2(1).

Now the ABAP run-time will assign the current value to each of the RB values. You can now determine in code whcih one was selected by the user.

Former Member
0 Kudos

Hi,

Include the 3 radio buttons in the same group, and one has to contain the value 'X' all the time. Check for this value.

if rb1, rb2, rb3 are the radiobuttons,

IF rb1 = 'X'

*logic for 1st radio button select.

ELSEIF rb2 = 'X'

*logic for 2nd radio button select.

ELSE.

*logic for 3rd radio button select.

ENDIF.

Thanks

Pranati