Application Development 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: 

SELECT-OPTIONS Obligatory During Runtime

Former Member
0 Kudos
166

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
107

Hi,

Use modify id statment when you are declaring it as parameter and then you can do that.

Atul

8 REPLIES 8

Former Member
0 Kudos
108

Hi,

Use modify id statment when you are declaring it as parameter and then you can do that.

Atul

Sandeep_Kumar
Product and Topic Expert
Product and Topic Expert
0 Kudos
107

In initiliazation you will not have the info how th eprogram will be executed.

0 Kudos
107

I was not aware of that. Wont the sy-batch be populated in the initialization event when run in background?

Sandeep_Kumar
Product and Topic Expert
Product and Topic Expert
0 Kudos
107

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.

Former Member
0 Kudos
107

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

Former Member
0 Kudos
107

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.

kesavadas_thekkillath
Active Contributor
0 Kudos
107

deleted

Edited by: Keshu Thekkillam on Nov 12, 2009 9:48 AM

0 Kudos
107

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.