‎2013 Dec 31 5:05 AM
Hello experts,
I have a requirement as below,
I should have two radiobuttons let it be r1 and r2, and i have two fields say f1 and f2, of which f1 is mandatory.
Now when i click r1 both the fields both the fields f1 and f2 must be disabled which i was able to acheive.
Now when i click r2 these fields f1 and f2 must be enabled, this also i acheived.
Now when again i click r1 these fields are not getting disabled and throwing an error message for filling mandatory fields, now if i fill the mandatory field and press enter the fields are getting disabled also if i fill the mandatory field and then press r1 these two fields are getting disabled.
Now when i press r1 again Can i make these two fileds disabled without filling the mandatory field.
Please help me in sorting out this issue
‎2013 Dec 31 5:14 AM
Hi -
Use the event - AT SELECTION-SCREEN OUTPUT event to perform this.
Let us know, in case any further help.
Regards,
Atul Mohanty
‎2013 Dec 31 5:13 AM
Hi Kumar,
Remove the Mandatory statement in your code(Obligatory).
‎2013 Dec 31 5:17 AM
HI Kumar,
I need to mainatain the field as mandatory, that is the requirement.
‎2013 Dec 31 5:14 AM
Hi -
Use the event - AT SELECTION-SCREEN OUTPUT event to perform this.
Let us know, in case any further help.
Regards,
Atul Mohanty
‎2013 Dec 31 5:17 AM
‎2013 Dec 31 5:25 AM
Hi Sathish,
If you are using user command for radio button, fields should be as mandatory.
Instead of please check that field is not initial.
Then only you can disable the field.
Arivazhagan S
‎2013 Dec 31 5:28 AM
Do as mentioned below.
if sy-ucomm eq 'ONLI'.
if field1 is initial.
message Please enter field
endif.
endif.
Nabheet
‎2013 Dec 31 5:37 AM
Can you pls explain your answer through code
This is how i declared my fields
SELECT-OPTIONS xxx FOR yyy OBLIGATORY.
‎2013 Dec 31 5:39 AM
Hi nabheet,
I need to mainatain the field as mandatory, that is the requirement.
‎2013 Dec 31 5:49 AM
Hi Satish
Field will be mandatory only. Only thing is we will be checking the field via code when you execute it
Nabheet
‎2013 Dec 31 6:07 AM
Hi Satish,
As mentioned, you need to acheive the mandatory requirement by explicit coding.
You can code it either in the at selection screen event or start of selection event.
START-OF-SELECTION.
if mnd_fld is INITIAL.
Message 'Enter value for mand field' type 'S' display like 'E'.
exit.
endif.
‎2013 Dec 31 7:37 AM
Hi Satish -
You need to remove the 'OBLIGATORY' key word and write code for that in
AT SELECTION SCREEN OUTPUT event to modify the SCREEN structure Otherwise you can put some code in START OF SELECTION like check initial and throw a infornation mesaage and LEAVE LIST Processing.
Let us know , in case any further help.
Regards,
Atul Mohanty
‎2013 Dec 31 8:12 AM
Hi nabheet,
Am almost done with this requirement. Could you please explain what is this 'onli' in your code below
if sy-ucomm eq 'ONLI'.
I implemented the logic as per your advice but the problem now is error message is being thrown even when i select the first radio button and click execute
‎2013 Dec 31 8:20 AM
Create a dummy function code and attach it to the radiobutton group (option USER-COMMAND on the first button of the group) so in the AT SELECTION-SCREEN you would be able to not execute the tests for mandatory field when user just pressed the button.
* Always add a top of report
TABLES: sscrfields.
* Attach dummy function code to radio button
PARAMETERS: b1 RADIOBUTTON GROUP radi USER-COMMAND but DEFAULT 'X'.
" (...)
* Validations in PAI
AT SELECTION-SCREEN.
CASE sscrfields-ucomm.
WHEN 'BUT'.
" ignore
WHEN 'ONLI' OR 'PRIN'.
" perform "heavy checks" only when Execute/Print (select single from transaction data)
" perform "light checks" (like mandatory fields, select single from master data)
WHEN OTHERS. " Enter, etc.
" perform "light checks
ENDCASE.Regards,
Raymond
‎2014 Jan 03 6:31 AM
Hi Nabheet,
Thanks for your answer i completed the requirement
thanks and regards,
Satish Kumar
‎2013 Dec 31 5:22 AM
Dear Satish,
Just move the obligatory statement from your selection screen deceleration part. The place where you have written code (Must be in event AT Selection Screen Output) to make the field disable just put:
if screen-name eq 'F1'.
Screen-require = 1.
endif.
Thanks,
Prakash
‎2013 Dec 31 5:39 AM
Hi Prakash,
I need to mainatain the field as mandatory, that is the requirement.
‎2013 Dec 31 5:47 AM
Hi Satish,
The same mandatory thing can be achieved by code. It will not hamper the requirement. You make F1 mandatory when its enabled and non mandatory when its not enabled.
Thanks,
Prakash
‎2013 Dec 31 7:45 AM
Hi Satish,
If you are using the obligatory statement then the system will take care of validating. It causes problem to your requirement, whereas If you remove the obligatory and add the external coding in AT selection screen event for validating the field you can acheive your requirement. The only change you can view is, the mandatory symbol will not be present in the selection screen field but the explicit code which you are writing will take care of it and in the error message you can state that the particular field has to be filled.
Hope it is clear now.
With Regards,
Giriesh M
‎2014 Jan 03 6:33 AM
‎2013 Dec 31 6:02 AM
Hi,
You can try this.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : p_y RADIOBUTTON GROUP rg USER-COMMAND s DEFAULT 'X',
p_m RADIOBUTTON GROUP rg.
PARAMETERS: p_one TYPE Numc04 OBLIGATORY MODIF ID one,
p_two TYPE Numc04 OBLIGATORY MODIF ID two.
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN OUTPUT.
IF p_y = 'X'. "Suppressing The Month and Year Field
LOOP AT SCREEN.
IF screen-group1 = 'ONE'.
screen-input = '0'.
ELSEIF screen-group1 = 'TWO'.
screen-input = '0'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ELSEIF p_m = 'X'.
LOOP AT SCREEN.
IF screen-group1 = 'ONE'.
screen-Input = '1'.
ELSEIF screen-group1 = 'TWO'.
screen-input = '1'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
AT SELECTION-SCREEN.
IF p_m EQ 'X'.
p_one = '1000'.
p_two = '2000'.
ENDIF.
IF p_y EQ 'X'.
p_one = ' '.
p_two = ' '.
ENDIF.
Or you can use initialization event to avoid the error message.
Or paste your code.
Regards.
‎2014 Jan 03 6:34 AM