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

SELECT-OPTIONS Obligatory During Runtime

Former Member
0 Likes
1,271

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
Read only

Former Member
0 Likes
1,212

Hi,

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

Atul

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.

8 REPLIES 8
Read only

Former Member
0 Likes
1,213

Hi,

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

Atul

Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
1,212

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

Read only

0 Likes
1,212

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

Read only

0 Likes
1,212

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.

Read only

Former Member
0 Likes
1,212

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

Read only

Former Member
0 Likes
1,212

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.

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,212

deleted

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

Read only

0 Likes
1,212

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.