‎2006 Nov 03 5:05 PM
Hi,
can you please correct my code:
<b>select-options: s_werks for marc-werks.</b>
.......................
......................
form get_data.
<b>if s_werks EQ 'KNX'.</b>
*-- Here the if statement is not working. Can you please correct this IF statement, if it is wrong.
<b> select * from mdkp
where matnr = i_mara-matnr.
......................
.....................
endif.</b>
Thanks,
‎2006 Nov 03 5:06 PM
‎2006 Nov 03 5:06 PM
‎2006 Nov 03 5:17 PM
John,
i have a small doubt,
is the statement
if s_werks-LOW eq EQ 'KNX'
checks only the first value or the entire range?
If only first value, lets assume 'KNX' exist in middle then how ?
sailesh
‎2006 Nov 03 5:22 PM
Checks only first value... that is why I asked if you truly need a SELECT_OPTIONS statement. If the user can enter multiple values, then use "IN s_werks".
Or simply LOOP thru the internal table S_WERKS.
‎2006 Nov 03 5:09 PM
sey,
u can't use if s_werks EQ 'KNX'.
as s_Werks is a select-option and it will be having multiple entries so can't use 'EQ'.
where u can use
<b>loop at s_werks.
if s_werks-low eq 'KNX'.
endif.
endloop.</b>
-Anu
Message was edited by: Anupama Reddy
Message was edited by: Anupama Reddy
Message was edited by: Anupama Reddy
‎2006 Nov 03 5:09 PM
Thnx John.
It worked!!!! But still there's a problem
if I have multiple values for S_WERKS, it wont work, right?
Thnx.
Message was edited by: sey ni
‎2006 Nov 03 5:18 PM
sey,
loop at s_werks and in the loop check with each s_werks-low as given by me above post.
-Anu
‎2006 Nov 03 5:22 PM
Right you will need to loop at the select-option and check each one.
But that will only help when the user does single values, he could do ranges also, so you should take care of that as well. Suggestion, get all of the plants in the select-option from table t001w, then check each one.
data: it001w type table of t001w with header line.
select-options: s_werks for it001w-werks.
select * into table it001w from t001w
where werks in s_werks.
loop at it001w.
<b> if it00w1-werks = 'KNX'.
endif.</b>
endloop.Regards,
Rich Heilman
‎2006 Nov 03 5:29 PM
Thanks Folks,
Yeah. I got it now. As it is select-option, i hve to do the loop.
Thanks again for ur valuable responses, I appreciate that.
But I can give 10 points to only one of you :)-
‎2006 Nov 03 5:31 PM
‎2006 Nov 03 5:31 PM
HI Sey,
Please give the points to appropriate person and close the thread. It also encourages the other persons.
sailesh
‎2006 Nov 03 5:34 PM
‎2006 Nov 03 5:10 PM
Sey ni,
s_werks is a range table. It can be used with comparison operator IN.
ist it
<pre>
select * from mdkp
where PLWRK in s_werks
and matnr = i_mara-matnr.
</pre>
Sorry, I don't know your context.
Regards,
Clemens
‎2006 Nov 03 5:15 PM
Bear in mind that SELECT-OPTIONS are range values associated with an internal table. The use of IN might be necessary... not sure of your needs. Do you need a select-options or will a parameter do the trick?
‎2006 Nov 03 5:11 PM
I don't think I'bve seen it done this way, but try:
if 'KNX' in s_werks.Rob