‎2008 Nov 24 12:55 PM
Hi friends,
i want to select records from mara table which first letter starts with "M". how should i write it.
regards
Kumar m
‎2008 Nov 24 1:04 PM
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%'.
‎2008 Nov 24 1:02 PM
‎2008 Nov 24 1:04 PM
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%'.
‎2008 Nov 24 1:05 PM
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.
‎2008 Nov 24 1:08 PM
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.