‎2007 Nov 02 7:54 AM
Hi all,
I have a doubt.
example. select * from mara where matnr = 1234 and werks = ' * ' . where werks i want to keep werks * ie any value how to do it.
I have to use werks field. can i use just %.
Kindly help .
thanks
mahesh
‎2007 Nov 02 7:59 AM
Hi,
In that case don't use werks in select query.Just query the table on matnr.
in this case it will fetches the material in different locations.
Thanks,CSR.
‎2007 Nov 02 8:01 AM
use like this
select * from mara where matnr = '1234'.
this will solve ur problem
‎2007 Nov 02 8:03 AM
Hi,
In mara table there is no werks use marc table and try like this
select * from marc where matnr = '1234' .
Reward if helpful
Regards,
Nagaraj
‎2007 Nov 02 8:04 AM
Hi,
Do like this
select * from mara where matnr = 1234. No need to give the werks in where condition.
Reagrds,
Prashant
‎2007 Nov 02 8:09 AM
HI THERE,
IF YOU WANT TO SELECT ANY PLANT THEN NO NEED TO USE IT IN THE QUERY. AND BE AWARE THAT YOU DON'T HAVE WERKS FIELD IN MARA TABLE YOU HAVE TO SELECT THAT FROM MARC TABLE.
REGARDS
THARANATHA
‎2007 Nov 02 8:13 AM
hai
data: m_mara type mara.
SELECT * FROM mara
INTO TABLE m_mara
WHERE matnr = '1234'.
i think u can help
regard
nawa
‎2007 Nov 02 8:49 AM
hI ALL,
but my requirement is matnr = 1234 and the werks field for example if it is H101 in the begining if sy-subrc NE 0 i will keep reducing in this manner
h10%
h1&
h%
% untill all characters are searched in the table .My question is finally for any plant is there any option such as * or %.
thanks ,
mahesh
‎2007 Nov 02 7:06 PM
Hi,
Try this way
data : v_like(4) type c.
concatenate 'H__%' space into v_like.
select * from marc into table i_marc
where matnr eq '1234'
and werks like v_like.
a®
‎2007 Nov 02 6:51 PM
As Nagaraj stated aboev, WERKS is not a field in the MARA Table. Why Query for WERKS? What are requirements and what are your trying to accomplish with your results?
‎2007 Nov 02 6:59 PM
in mara table u wont find werks.....
u will find it marc table....
select amatnr bwerks from mara as a join marc as b on bmatnr = amatnr
whwre a~matnr = '1234' and werks = '1%'.
it will retrive the data from mara and marc which the material number is 1234 and werks that start with 1.....
‎2007 Nov 02 7:01 PM
Hello Mahesh,
Your query, "select * from mara where matnr = 1234 and werks = ' * ' .", won't fetch any data since MARA doesn't have WERKS field.
Instead you need to write like this "<b>select * from MARC where matnr = 1234"</b>" this will fetch all the data for all Plants for which MATNR = 1234
Hope this will be useful
Kindly reward points if it helps.
Regards
Sujay