2011 Apr 18 8:17 PM
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.
2011 Apr 18 8:22 PM
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.
2011 Apr 18 8:22 PM
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.
2011 Apr 18 8:36 PM
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.
2011 Apr 18 8:54 PM
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.
2011 Apr 18 8:57 PM
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
2011 Apr 18 9:44 PM
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
2011 Apr 19 2:34 PM
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.
2011 Apr 19 8:34 PM
2012 Jan 23 4:53 PM
Hi Anik,
Did u get solved this problem? If so Can you give me the solution?
I have the same issue.
Regards,
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |