2009 Jan 06 12:39 AM
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.
2009 Jan 06 12:52 AM
2009 Jan 06 1:50 AM
2009 Jan 06 2:47 AM
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
2009 Jan 06 3:57 AM
hi,
AT SELECTION-SCREEN.
If R_A = 'X' .
P_TEXT = 'A'.
ELSEIF R_B= 'B'.
P_TEXT = 'B'.
ENDIF.
modify screen.
thanks
2009 Jan 06 3:58 AM
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
2009 Jan 06 4:23 AM
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