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 statement

Former Member
0 Likes
502

Hi,

In my selection screen, i have material no.

i have to select the materials for the MARD table. for ex, if the user entered a mat no 12345600

i need result in the internal table like

12345600

12345601

12345602

12345603

12345604

For this, how to write the select query?

Thanks

Karthi.S

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
470

karthi,

how do you specify the logic of fetching the rest of the matnr? on what basis? any thing starting with '123456'.. if yes then a LIKE keyword in select statement that would do..

3 REPLIES 3
Read only

Former Member
0 Likes
471

karthi,

how do you specify the logic of fetching the rest of the matnr? on what basis? any thing starting with '123456'.. if yes then a LIKE keyword in select statement that would do..

Read only

0 Likes
470

Hi,

this is answer for that.

LOOP at s_matnr.

CONCATENATE s_matnr-low+0(16) '%' into v_mat.

SELECT matnr werks lgort labst umlme

insme einme speme retme vmlab vmuml

from mard

INTO TABLE it_mard

WHERE matnr like v_mat and

werks in S_werks and

lgort in s_lgort.

CLEAR : v_mat.

Endloop.

Read only

0 Likes
470

this would cause you serious performance issues as you are selecting inside loop.

better modify the select option separately with adding a %...

then use select option at a time...

like..

loop at s_matnr.
 s_mantnr-low+16 = '*'. "make the last char as '*'.. try with other options as well as well
 s_matnr-option = 'CP'.
  modify s_matnr.
endloop. 

select ... from .... into table ... where matnr in s_matnr"this already keep CP
                                  and ... and ..