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

Dialog Programming - Radio Buttons

Former Member
0 Likes
1,373

Hi all,

I facing one problem in dialog programming.

I have 3 radio buttons on screen . When user selects one radio button, some input fields need to be disabled and similarly for other 2 radio buttons also. Please let me know how to do that. I have defined 3 radio buttons under one group ‘RADIO’.

TIA,

Ramesh

Hi all,

I facing one problem in dialog programming.

I have 3 radio buttons on screen . When user selects one radio button, some input fields need to be disabled and similarly for other 2 radio buttons also. Please let me know how to do that. I have defined 3 radio buttons under one group ‘RADIO’.

TIA,

Ramesh

8 REPLIES 8
Read only

Former Member
0 Likes
1,150

Hi Ramesh,

in screen painter it's quite easy (I have no experience in dialog programming, but I think it's quite similar).

- First of all, you should define your radiobuttons so that they trigger a user-command (no matter what its name is, just trigger an ok_code). This can be achieved when displaying attributes of the radiobutton

- Then, at PBO, include this sketch of code:


loop at screen.
  if not rb1 is initial.
    if screen-name = 'FIELD1' or screen-name = 'FIELD2'.
      screen-input = '0'.
      modify screen.
    endif.
  elseif not rb2 is initial.
    if screen-name = 'FIELD1' or screen-name = 'FIELD2'.
      screen-input = '1'.
      modify screen.
    endif.
  elseif not rb3 is initial.
    if screen-name = 'FIELD1' or screen-name = 'FIELD2'.
      screen-input = '1'.
      modify screen.
    endif.
  endif.
endloop.

...well, you should "play" for a little while with which fields you want to disable and when you want to do it.

Pls let us know if it helped. BR,

Alvaro

Read only

0 Likes
1,150

Hi all,

Thanks for for youe valuable suggestions.

I need some more help.

in my screen all the input boxes are mandatory.when user do not wish to enter any values and want leave the screen,i made the default buttons 'END' and 'CANCEL' active with function type 'EXIT'. But it is not working.

Could any of U tell me what might have went wrong??

TIA,

Ramesh

Read only

0 Likes
1,150

Hi,

Do you have a module with AT EXIT-COMMAND where you are processing Cancel and Exit.

Regards

Read only

0 Likes
1,150

Hi,

Thanks for your response.

I was able to do this with at EXIT-COMMAND.

Earlier I was not passing function code to my local variable in the program.

Ramesh

Read only

lauraquinteros
Participant
0 Likes
1,150

Hi Ramesh,

you could loop the screen internal table, witch handles all screen fields defined in a dynpro.

It would be something like this:

loop at screen.

if screen-name = (your field name here).

screen-input = 0.

  • Here see if it's 1 or 0 for disabling/enabling a field

*on your dynpro.... I don't remember it

endif.

endloop.

Hope this helps.

Regards,

Laura

Read only

0 Likes
1,150

Ramesh, those two postings will definitely help you.

On the other hand, I'm curious why you would want to disable the other two radio buttons.

What if they made a mistake and really want to choose another radio button ?

Just a thought....good luck on your program.

Read only

ssimsekler
Product and Topic Expert
Product and Topic Expert
0 Likes
1,150

Hi Jonathan

What Ramesh wants is not to disable other two buttons but disable some input fields with respect to the selected radio button.

*--Serdar

[email protected]

Read only

0 Likes
1,150

Well that makes a lot of sense, thank you Serdar for pointing it out.

Also Ramesh, you can assign an OK-CODE on your radio buttons so once the user selected one of the options, it will go right away to PAI then to PBO, where you can do your LOOP AT SCREEN...ENDLOOP. Saves the time of pressing ENTER after selecting one of the radio.

Cheers !