‎2005 Jun 30 9:26 AM
Hi All,
I am having a select-option(s_matnr).I want to assign the values in select-option to ranges.
I am declaring ranges as below.
ranges r_matnr for mara-matnr.
I want to use the ranges in select statement.
Suppose I am entering values 1(s_matnr-low) and 10(s_matnr-high) in selection-screen.
I did the following code.But it is not working as I expected.
loop at s_matnr.
r_matnr-sign = 'I'.
r_matnr-option = 'EQ'.
IF NOT ( s_matnr-low IS INITIAL ).
r_matnr-low = s_matnr-low.
endif.
if not ( s_matnr-high is initial ).
r_matnr-high = s_matnr-high.
endif.
append r_matnr.
endloop.
select * from mara into table itab where matnr in r_matnr.
But the result is not same as
select * from mara into table itab where matnr in s_matnr.
Could any one tell how to produce the same result as I am getting in s_matnr?
PS:
I <b>don't</b> want to assign
r_matnr[] = s_matnr[].
If I did like that , it is producing the same result as that of s_matnr.
But I want to know what is wrong in the code I mentioned.
Any useful pointers will be rewarded.
‎2005 Jun 30 9:40 AM
Hi Jayanthi,
for one thing, you are not properly manipulating the values for the <b>option</b> (and possibly the <b>sign</b> field).
For example, if both high and low are populated on the select-options, then the value of OPTION will not be EQ. It will be BT.
You can write a small test program which I'm sure will help you understand what is wrong with your code -
tables mara.
select-option s_matnr for mara-matnr.
loop at s_matnr.
write : / s_matnr-sign,
s_matnr-option,
s_matnr-low,
s_matnr-high.
endloop.Regards,
Anand Mandalika.
‎2005 Jun 30 9:40 AM
Hi Jayanthi,
for one thing, you are not properly manipulating the values for the <b>option</b> (and possibly the <b>sign</b> field).
For example, if both high and low are populated on the select-options, then the value of OPTION will not be EQ. It will be BT.
You can write a small test program which I'm sure will help you understand what is wrong with your code -
tables mara.
select-option s_matnr for mara-matnr.
loop at s_matnr.
write : / s_matnr-sign,
s_matnr-option,
s_matnr-low,
s_matnr-high.
endloop.Regards,
Anand Mandalika.
‎2005 Jun 30 9:46 AM
‎2005 Jun 30 9:50 AM
Hello,
This should work.
loop at s_matnr.
r_matnr-sign = s_matnr-sign. "'I'.
r_matnr-option = s_matnr-option. "'EQ'.
I am not sure why you want to check here that the s_matnr-low field is intial... anyways... does not make a difference...
***
IF NOT ( s_matnr-low IS INITIAL ).
r_matnr-low = s_matnr-low.
endif.
if not ( s_matnr-high is initial ).
r_matnr-high = s_matnr-high.
endif.
append r_matnr.
endloop.
or best option is r_matnr[] = s_matnr[].
Regards,
Shekhar Kulkarni
‎2005 Jun 30 9:55 AM
Hi All,
Thanks for reply.
That is problem in option as Anand pointed out.
Now it's ok.
Thanks Anand.