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: 

Radiobutton text value at runtime

Former Member
0 Kudos

Hi

Can anyone help me in finding out how we can set the text value of radiobutton at runtime.

Edited by: Hitesh Sachdeva on Mar 22, 2010 3:11 PM

7 REPLIES 7

venkat_o
Active Contributor
0 Kudos

Hi, If I understood rightly, <li>Try this way.


REPORT ztest.
DATA:text_value VALUE '2'.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS:r1 RADIOBUTTON GROUP gr1.
SELECTION-SCREEN COMMENT 2(15) com1 FOR FIELD r1.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS:r2 RADIOBUTTON GROUP gr1.
SELECTION-SCREEN COMMENT 2(15) com2 FOR FIELD r2.
SELECTION-SCREEN END OF LINE.

AT SELECTION-SCREEN OUTPUT.
  IF text_value = '1'.
    com1 = 'Radiobutton 1'.
    com2 = 'Radiobutton 2'.
  ELSE.
    com1 = 'Radiobutton 2'.
    com2 = 'Radiobutton 1'.
  ENDIF.
Thanks Venkat.O

Former Member
0 Kudos

hi,

please be more specific what is the requirement,what i understood is if one variable hav some value then check a particular radio button other wise check other like below.


SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.   
PARAMETERS : 
            p_select TYPE c value 'X',
             p_fgnd TYPE c RADIOBUTTON GROUP r1   modif id id1  USER-COMMAND xyz DEFAULT 'X', "Select a radio button , 
             p_bgnd TYPE c  RADIOBUTTON GROUP r1 .
SELECTION-SCREEN END OF BLOCK b1.

now you have to loop on screen


AT selection-screen output.
 
if p_select = 'X'.
loop at screen.
if screen-group1 EQ 'ID1'.
    p_fgnd  = 'X'.
modify screen.
endif.
endloop.
else
  if screen-group1 NE 'ID1'.
   loop at screen.
   p_bgnd  = 'X'
   modify screen.
 endif.
endloop.
endif.

hope this heelps,

thanks

tanmaya

Former Member
0 Kudos

Hi

How can i do this in module pool.

Former Member
0 Kudos

Hi Hitesh,

1. Declare required charector variables with the initial values for your radio button text

2. Create the radio buttons in the screen painter, and put the Input/Output field from the Screen painter to the corresponding

radio buttons and in the field attributes for each text use the variables declared in the program. Make the those text

field Out put only.

3. In the PBO module of the particular screen you change those variable values ( your radiobutton text) as per your

requirement.

Hope this may help you.

Regards,

Smart Varghese

Former Member
0 Kudos

Hi

Actually i don't want to put text field (i.e INPUT/OUTPUT) .But I want to chage the text value of radiobutton at runtime in module pool. I also need the code for the same.

Edited by: Hitesh Sachdeva on Mar 23, 2010 11:00 AM

0 Kudos

Hi Hitesh,

I know your requirement, you want a dynamic text description for your radio button.

In module pool you have place that text description in a place holder, for that, make use of an INPUT/OUTPUT field (with output only option in the field attribute) from the screen painter. Name that field the variable name which you declared in the program. Initially you give that value to the variable which as to be displayed as the radiobutton text. You can change that value of that field( means the description text for radiobutton) by just changing the value of the declared variable. in the PBO of the screen.

For eg.

DATA: v_text(16) type c value 'My Radio button'.

In the screen painter for the description text field for radio button give the variable name ie V_TEXT

When you change the value in the v_text it will be reflected in the text description for the radio button.

This will solve the issue.

Regards,

Smart Varghese

Former Member
0 Kudos

Hi Hitesh,

Firstly, you cannot change the value of the Text field Dynamically through a Variable, even though you have the same names both in the report program, and in the screen elements.

In this case you can achieve the same in another way, by the use of the Input field.

Instead of Text field, go for a Input field, and mark the "Output Only" attribute in the Display tab of that input field.

Now maintain the same name in the report program, and change as per your need.

Note: Output only Input fields look same as the Text field.

Hope it helps.

Thank you,

Regards,

Shashi