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: 

Changing of default values on the selection screen dynamically

Former Member
0 Kudos
817

Hi,

I have 2 radiobuttons R_A & R_B and i have one text field like P_TEXT. Based on selection of radio button i have to change the default values in P_TEXT on the selection screen. like if i select R_A i have to display P_TEXT = 'A'. if i select R_B then it has to display P_TEXT = 'B'. I tried like as below

in AT SELECTION-SCREEN OUPUT EVENT.

IF R_A = 'X'

P_TEXT = 'A'.

ELSEIF R_B= 'B'.

P_TEXT = 'B'.

ENDIF.

But it's not working. it is working only for first radio button. when i select second radio button it is not giving the second value. can any one tell the sol.

Tks in advance.

6 REPLIES 6

Former Member
0 Kudos
377

Hi,

Use statement

MODIFY SCREEN.

after your code

Regards

Akshay

Former Member
0 Kudos
377
IF R_A = 'X'
   P_TEXT = 'A'.
* ELSEIF R_B= 'B'.  " Radiobutton value will never be "B"
ELSE. " If one radio button of the group is initial the other is set.
   P_TEXT = 'B'.
ENDIF.

Try it this way...

PARAMETERS: p_rb1 RADIOBUTTON GROUP rad1 DEFAULT 'X' USER-COMMAND abc,
            p_rb2 RADIOBUTTON GROUP rad1,
            p_text TYPE char10.

AT SELECTION-SCREEN OUTPUT.
  CASE 'X'.
    WHEN p_rb1.
      p_text = 'A'.
    WHEN p_rb2.
      p_text = 'B'.
  ENDCASE.

~Eswar

Former Member
0 Kudos
377

hi,

AT SELECTION-SCREEN.

If R_A = 'X' .

P_TEXT = 'A'.

ELSEIF R_B= 'B'.

P_TEXT = 'B'.

ENDIF.

modify screen.

thanks

Former Member
0 Kudos
377

Hi Pammi,

Update your code as follows

parameters: r_1 radiobutton group g1 user-command US1,

r_2 radiobutton group g1.

parameters text_1(10) type c.

at selection-screen output.

if r_1 = 'X'.

text_1 = 'R1'.

elseif r_2 = 'X'.

text_1 = 'R2'.

endif.

This will solve your issue. User command needs to be added as when ever you click on the radiobutton the at selection-screen output will be called, else you will have to trigger an event by pressing the execute or any button. With the addition user-command US1 the event will be triggered as soon as you click on the radiobutton.

Regards,

Sachin Dargan

I355602
Product and Topic Expert
Product and Topic Expert
0 Kudos
377

Hi Pammi,

Use this code, its working:-


PARAMETERS : r_a RADIOBUTTON GROUP gp1 DEFAULT 'X' USER-COMMAND rb,
             r_b RADIOBUTTON GROUP gp1,
             p_text(20).

"we use user command with the radiobutton so that some event is occured in order to call AT SELECTION-SCREEN OUTPUT.

AT SELECTION-SCREEN OUTPUT.

  IF r_a = 'X'.
    p_text = 'Hello'.
  ELSEIF r_b = 'X'.
    p_text = 'Hi'.
  ENDIF.

In the above case 'AT SELECTION-SCREEN OUTPUT' will act as PBO of the selection screen and will change value of selection text as per condition.

Hope this solves your problem.

Thanks & Regards,

Tarun Gambhir