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-option

Former Member
0 Likes
604

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?

7 REPLIES 7
Read only

Former Member
0 Likes
586

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 ..

Read only

Former Member
0 Likes
586

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

Read only

Former Member
0 Likes
586

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....

Read only

abdulazeez12
Active Contributor
0 Likes
586

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

Read only

Former Member
0 Likes
586

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

Read only

Former Member
0 Likes
586

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

Read only

Former Member
0 Likes
586

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.