‎2008 Jan 24 6:50 AM
hi all,
i am using select-option for material number. i want to use those material number 1 by 1 to fetch data. how to use loop for select-option (s_matnr).
can i use ..
loop at s_matnr .
endloop.
wat variable inside i can use?
‎2008 Jan 24 6:54 AM
Hi,
Yes, you can use LOOP AT S_MATNR.
get the values based on LOW & HIGH .
LOOP AT s_matnr.
s_matnr-low ....
s_matnr-high ....
ENDLOOP.
You must be carefull about option value of select-options.
It can be 'LE', 'BT' etc.....
s_matnr-options ..
‎2008 Jan 24 6:58 AM
Hi,
To fetch data, you can directly use the select option in the query.
e.g. select (field list) from mara into table i_matnr where matnr IN S_MATNR
Regards,
Shyam
‎2008 Jan 24 6:59 AM
sarika,
If you want to fetch the data from table
select .........
from xxxxtabel
into table i_itab
where matnr IN s_matnr.
OR for other purpose.
loop at s_matnr .
write your fetch logic
with s_matnr-low
s_matnr-low = s_matnr-low + 1.
IF s_matnr-low GT s_matnr-high.
EXIT.
ENDIF.
endloop
Don't forget to reward if useful....
‎2008 Jan 24 6:59 AM
Hi
If you wnt to use S_MATNR values to fetch data from other database tables, use this way:
SELECT <fields list> from <DATABASE_TABLE>
into table itab
WHERE
MATNR in S_MATNR.
the above statement will fetch all data fields which u want based on what u give in S_MATNR.
Reward points,
Shakir
‎2008 Jan 24 7:00 AM
Hi,
if u r selecting from data base then use
select * from database into internal_table where matnr in s_matnr.
OR
If ur requirement is for loop use follwing:
Loop at s_matnr.
u vl get the values in wa of s_matnr.
Its structure is as follows..Useit as follows:
S_matnr-low.
s_matnr-high
s_matnr-sign
s_matnr-option
endloop
‎2008 Jan 24 7:02 AM
Hi Sarika,
If you are using only single values in your select option, you can use s_matnr-low.
check if s_matnr-high is initial and s_matnr-sign = 'I' and s_matnr-option = 'EQ'.
Regards,
Mohaiyuddin
‎2008 Jan 24 7:27 AM
Hi Sarika,
In that case you have to take all the material numbers which are there in the internal table (from WBS ) based on your select option.
Like:
codeIT_MAT
4000
4001
4004
4008
...
8899[/code]
Then use this internal table for selection with FOR ALL ENTRIES IN IT_MAT addition in select.
hope this helps..........
kindly reward if found helpful.
cheers,
Hema.