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

Selection-screen parameter mandatory for radio button selection

Former Member
0 Likes
5,522

Hello,

One of the input field needs to be made mandatory when one of the radio-buttons on the selection screen is checked. I have used at selection screen output event, but if the user clicks the radiobutton that is used to make the field mandatory and then click the other one, the field is still showing as an obligatory field. Please let me know how to make the button flexible that one is selected field becomes mandatory and immediately if the other one is selected back the field needs to be optional.

This is the code I have written.

IF rad7 = 'X'.

LOOP AT SCREEN.

if screen-group1 = 'M1'.

screen-required = '1'.

MODIFY SCREEN.

endif.

ENDLOOP.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,977

Hi,

You need to write as :

IF rad7 = 'X'.

LOOP AT SCREEN.

if screen-group1 = 'M1'.

screen-required = '1'.

MODIFY SCREEN.

endif.

ENDLOOP.

ELSEIF rad8 = 'X'. <-- when other radio button is clicked

LOOP AT SCREEN.

if screen-group1 = 'M1'.

screen-required = '0'.

MODIFY SCREEN.

endif.

ENDLOOP.

ENDIF.

Regards,

Srini.

Hello,

One of the input field needs to be made mandatory when one of the radio-buttons on the selection screen is checked. I have used at selection screen output event, but if the user clicks the radiobutton that is used to make the field mandatory and then click the other one, the field is still showing as an obligatory field. Please let me know how to make the button flexible that one is selected field becomes mandatory and immediately if the other one is selected back the field needs to be optional.

This is the code I have written.

IF rad7 = 'X'.

LOOP AT SCREEN.

if screen-group1 = 'M1'.

screen-required = '1'.

MODIFY SCREEN.

endif.

ENDLOOP.

8 REPLIES 8
Read only

Former Member
0 Likes
2,978

Hi,

You need to write as :

IF rad7 = 'X'.

LOOP AT SCREEN.

if screen-group1 = 'M1'.

screen-required = '1'.

MODIFY SCREEN.

endif.

ENDLOOP.

ELSEIF rad8 = 'X'. <-- when other radio button is clicked

LOOP AT SCREEN.

if screen-group1 = 'M1'.

screen-required = '0'.

MODIFY SCREEN.

endif.

ENDLOOP.

ENDIF.

Regards,

Srini.

Read only

0 Likes
2,977

Srinivas,

Thanks for the response. I tried this way as well, but the field is not being refreshed. Once, it becomes mandatory after the radio button is selected, its not going back to the original.

AT SELECTION-SCREEN OUTPUT.

IF rad7 = 'X'.

LOOP AT SCREEN.

if screen-group1 = 'M1'.

screen-required = '1'.

MODIFY SCREEN.

endif.

ENDLOOP.

ELSEIF rad6 = 'X'.

LOOP AT SCREEN.

if screen-group1 = 'M1'.

screen-required = '0'.

MODIFY SCREEN.

endif.

ENDLOOP.

ENDIF.

Read only

0 Likes
2,977

Hi,

This is how the system behaves. Just enter a value in the field (after changing to Obligatory) and click on the

other radio button. Now the Mandatory field is refreshed.

Regards,

Srini.

Read only

naimesh_patel
Active Contributor
0 Likes
2,977

You will face while clearing the required fields, If you use the MANDATORY or REQUIRED when you change the radio-button. You should be doing the check in the START-OF-SELECTION, if the radiobutton is selected and field is empty. If so, give the error message and stop processing the program.

Regards,

Naimesh Patel

Read only

Former Member
0 Likes
2,977

Hi Kiran,

one other option you can try... please look at the code below.

this is simple and straight.

SELECTION-SCREEN BEGIN OF BLOCK master WITH FRAME.

PARAMETERS: tXT_box1 TYPE c LENGTH 10 ,

rb_one RADIOBUTTON GROUP rb USER-COMMAND usr DEFAULT 'X', " defaulting to radio button which is not mand..

rb_two RADIOBUTTON GROUP rb.

SELECTION-SCREEN END OF BLOCK master.

AT SELECTION-SCREEN .

IF rb_two IS NOT INITIAL.

IF tXT_box1 IS INITIAL.

MESSAGE 'Please fill Text box' TYPE 'E'. " add your custom message

ENDIF.

ENDIF.

try this option. let me know if it works for you or not...

thanks,

Rudra.

Edited by: Rudra s on Apr 18, 2011 10:44 PM

Read only

Former Member
0 Likes
2,977

hi,

Try this..

AT SELECTION-SCREEN.

IF RAD7 = 'X'.

FLAG = 'X'.

ENDIF.

AT SELECTION-SCREEN OUTPUT.

IF FLAG = 'X'.

LOOP AT SCREEN.

if screen-group1 = 'M1'.

screen-required = '1'.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

clear flag.

hope it solves ur issue.

Read only

Former Member
0 Likes
2,977

Thanks everybody for your time

Read only

0 Likes
2,977

Hi Anik,

Did u get solved this problem? If so Can you give me the solution?

I have the same issue.

Regards,