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

About Select Statement

Former Member
0 Likes
549

Hi friends,

i want to select records from mara table which first letter starts with "M". how should i write it.

regards

Kumar m

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
532

Hi

Which field would you like to choose?

You may try

select field1 field2 ...

into table i_tab

from mara

where condition_field like 'M%'.

4 REPLIES 4
Read only

Former Member
0 Likes
532

Hi Friends,

i am wating for answer.

Read only

Former Member
0 Likes
533

Hi

Which field would you like to choose?

You may try

select field1 field2 ...

into table i_tab

from mara

where condition_field like 'M%'.

Read only

Former Member
0 Likes
532

Hi,

I guess this code should help you to get the data starting with M as first letter in MATNR. I have bolded the where condition in which you have to use a variable where you concatenate the first letter and % for the selection. % is something like * when you are searching.

DATA: it_mara TYPE TABLE OF mara.

DATA: wa_mara TYPE mara.

DATA: l_variable(2) TYPE c.

CONCATENATE 'M' '%' INTO l_variable.

SELECT * FROM mara

INTO TABLE it_mara

WHERE matnr LIKE l_variable.

Read only

Former Member
0 Likes
532

Hi,

Do u mean to say that u want records from mara with perticular firlds (e.g. matnr) start with M.

Then u can try following,

select all data from mara into itab.

str = 'M*'.

loop at itab.

if itab-matnr = str1.

exit.

else.

delete itab index sy-tabix.

endif.

endloop.