2009 Nov 12 4:09 AM
Hello Gurus,
I have a weird requirement for my client.
Can we set a field on selection screen Obligatory during runtime..Just like module pool SCREEN-REQUIRED?
I want this to make the field manadatory if it is run in foreground and optional in Background using INITIALIZAIION section.
Is it possible?
Thanks in Advance for your Help!
Pavan.
2009 Nov 12 4:11 AM
Hi,
Use modify id statment when you are declaring it as parameter and then you can do that.
Atul
2009 Nov 12 4:11 AM
Hi,
Use modify id statment when you are declaring it as parameter and then you can do that.
Atul
2009 Nov 12 4:12 AM
In initiliazation you will not have the info how th eprogram will be executed.
2009 Nov 12 4:14 AM
I was not aware of that. Wont the sy-batch be populated in the initialization event when run in background?
2009 Nov 12 4:17 AM
Yes, sy-batch will be populated once you execute the program but then the program will be executed with the selections you have laready made.
2009 Nov 12 4:12 AM
Hello,
Try something like this,
SELECT-OPTIONS S_ABC for MARA-MATNR.
INITIALIZATION.
if not sy-batch = 'X'. "When the report is run in foreground
if S_ABC [] is initial.
message 'Please Enter a value' type 'E'.
endif.
endif.
Vikranth
2009 Nov 12 4:16 AM
Thanks for all quick replies..
Hi Atul,
Can you please explain me a little more in detail how to use modify id as i have never used it before.
Thanks!
Pavan.
2009 Nov 12 4:17 AM
2009 Nov 12 5:23 AM
Thanks Atul...
Here is the Working Code for the requirement...
SELECT-OPTIONS S_PTYPE FOR SAPLANE-PLANETYPE MODIF ID ABC.
AT SELECTION-SCREEN OUTPUT.
if sy-batch = ' '.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'ABC'.
SCREEN-REQUIRED = '1'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.