Application Development and Automation 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: 
Read only

radio button.

Former Member
0 Likes
808

Hi i have created one screen . in the layout of the screen i created one objective type question with three radiobutton opions now if i click one radio button i want some text in other screen. could you please help me to do the same?

Thanks

9 REPLIES 9
Read only

Former Member
0 Likes
779

Hello,

Check this code.


PROGRAM demo_dynpro_check_radio .

DATA: radio1(1) TYPE c, radio2(1) TYPE c, radio3(1) TYPE c,
      field1(10) TYPE c, field2(10) TYPE c, field3(10) TYPE c,
      box TYPE c.

DATA: ok_code TYPE sy-ucomm,
      save_ok TYPE sy-ucomm.

CALL SCREEN 100.

MODULE user_command_0100 INPUT.
  save_ok = ok_code.
  CLEAR ok_code.
  CASE save_ok.
    WHEN 'RADIO'.
      IF radio1 = 'X'.
        field1 = 'Selected!'.
        CLEAR: field2, field3.
      ELSEIF radio2 = 'X'.
        field2 = 'Selected!'.
        CLEAR: field1, field3.
      ELSEIF radio3 = 'X'.
        field3 = 'Selected!'.
        CLEAR: field1, field2.
      ENDIF.
    WHEN 'CANCEL'.
      LEAVE PROGRAM.
  ENDCASE.
ENDMODULE.

Vasanth

Read only

0 Likes
779

This is on same screen . But I want on different screen.

Read only

0 Likes
779

when radiobuton = 'x'.

write 'ddfgg'.

why it is not working? It's not writing anything

Read only

0 Likes
779

Hello,

when radiobuton = 'X'.  " Make to upper case

Vasanth

Read only

Former Member
0 Likes
779

check out abapdocu

Read only

Former Member
0 Likes
779

hi,

follow this logic.

PROGRAM demo_dynpro_check_radio .
 
DATA: radio1(1) TYPE c, radio2(1) TYPE c, radio3(1) TYPE c,
      field1(10) TYPE c, field2(10) TYPE c, field3(10) TYPE c,
      box TYPE c.
 
DATA: ok_code TYPE sy-ucomm,
      save_ok TYPE sy-ucomm.
 
CALL SCREEN 100.
 
MODULE user_command_0100 INPUT.
  save_ok = ok_code.
  CLEAR ok_code.
  CASE save_ok.
    WHEN 'RADIO'.
      IF radio1 = 'X'.
      CALL SCREEN 200." in this screen you write text as per your need.
     **   field1 = 'Selected!'.
        CLEAR: field2, field3.
      ELSEIF radio2 = 'X'.
        CALL SCREEN 200. "in this screen you write text as per your need
     **   field2 = 'Selected!'.
        CLEAR: field1, field3.
      ELSEIF radio3 = 'X'.
        CALL SCREEN 300. "in this screen you write text as per your need
     **   field3 = 'Selected!'.
        CLEAR: field1, field2.
      ENDIF.
    WHEN 'CANCEL'.
      LEAVE PROGRAM.
  ENDCASE.
ENDMODULE.

in the above program you write text as per your need in different screen depends on selected radio button.

regards,

Ashokreddy.

Read only

Former Member
0 Likes
779

Hi Ajay,

Here is a solution to your problem. I created a program in SE38. Then before writing anything in the program, I just saved it and went to Se51. There giving the name of the above program and screen number as 0001, i created a screen where in the layout I put two radiobuttons as R1 and R2 and defined a gropu on them (so that they gine me a mutually exclusive beahvior). I ceated two pushbuttons, one as Execute (with Func code EXECUTE) and another as Exit (with Function code EXIT). In the PAI (process after input) event of this screen, i gave the logic of what should happen when radiobutton R1 is clicked and whar should happen if radiobutton R2 is clicked.

Then again i go to transaction SE51 and create two screens one after another with screen numbers 2 and 3 respectively. In each screen I give somne demo text (u can give ur relevant text here) and a pushbutton Back (with Function Code BACK) to go back to main screen.

Here is the code for the same.

REPORT ZSS_TEST message-id zmsg.

Data : R1(1) type c,

R2(1) type c.

call screen 1. "Main screen

&----


*& Module USER_COMMAND_0001 INPUT

&----


  • text

----


MODULE USER_COMMAND_0001 INPUT.

case sy-ucomm.

when 'EXECUTE'.

if R1 = 'X'.

call screen 2.

else.

call screen 3.

endif.

when 'EXIT'.

Leave program.

endcase.

ENDMODULE. " USER_COMMAND_0001 INPUT

&----


*& Module USER_COMMAND_0002 INPUT

&----


  • text

----


MODULE USER_COMMAND_0002 INPUT.

case sy-ucomm.

when 'BACK'.

Leave to screen 0.

endcase.

ENDMODULE. " USER_COMMAND_0002 INPUT

&----


*& Module USER_COMMAND_0003 INPUT

&----


  • text

----


MODULE USER_COMMAND_0003 INPUT.

case sy-ucomm.

when 'BACK'.

Leave to screen 0.

endcase.

ENDMODULE. " USER_COMMAND_0003 INPUT

If any doubts, u can ask me. Hope it helps u.

Read only

0 Likes
779

Hi,

Thanks for your answer. i was good and helpful. but what i was trying to do is that i had created few objective quetions in the screen layout. now after submit button i want the score like " Your score is 76%" or 6 qs are right out of ten".just like online test. it is easy but i am not geting the desired output.

Cd you plz help me in this.

Read only

0 Likes
779

Hi,

Initially you must have stored the correct answers of your questions in a table with a key where key would serve as the number of the question. So when a user selects a radiobutton as an answer for a question, you will check your database that whether the answer is correct or not. If yes then you will add appropriate scores in a global variable which you will keep on upadting on every correct answer. When the user presses the submit button, you can display the result of this global variable on your next screen(or subscreen).

I think this would give you some idea of how to proceed and would be helpful to you.