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

different values from SE16 and SQL query

Former Member
0 Likes
1,046

Hi all,

I have been writing a query as

SELECT A~MATNR A~MEINS B~WERKS B~XCHPF C~LGORT C~LABST
       INTO corresponding fields of TABLE IT_PSET1
       FROM  ( ( MARA AS A INNER JOIN MARC AS B
                 ON A~MATNR = B~MATNR )
                 INNER JOIN MARD AS C
                 ON B~MATNR = C~MATNR )
WHERE A~MATNR IN S_MATNR " AND B~WERKS IN S_WERKS
AND B~XCHPF <> 'X' AND C~LABST > 0.

the db cnt from dis query is 2841

but if I go to se16 and select materials from MARC with XCHPF <> X and

give the output material list as input run of se16 for MARD also giving selection as LABST > 0, then I get db cnt as 3017.

Please help me to resolve this diffrence.

Thanks and regards,

Edited by: Thomas Zloch on Nov 16, 2010 1:07 PM - formatting fixed

4 REPLIES 4
Read only

Former Member
0 Likes
813

Hi Swetha,

You have to folow the same flow what u written in your query . first u will take matnr from mara then u have to pass those materials to marc with your condition. after that u pass these values to mard . you will get the same entries

Edited by: karthikeyanks on Nov 16, 2010 11:11 AM

Edited by: karthikeyanks on Nov 16, 2010 11:15 AM

Read only

Former Member
0 Likes
813

Hi Swetha,

You have to folow the same flow what u written in your query . first u will take matnr from mara then u have to pass those materials to marc with your condition. after that u pass these values to mard . you will get the same entries

Read only

0 Likes
813

Hi,

In both the above scenario if I pass material number only then I get 3657 values

and if in se16n I pass plant(werks) its giving dump,

but still 3017 is not coming.

Read only

0 Likes
813

Hi

The query seems to be wrong, because the link between MARD and MARC is missing:

 SELECT A~MATNR A~MEINS B~WERKS B~XCHPF C~LGORT C~LABST
       INTO corresponding fields of TABLE IT_PSET1
       FROM  MARA AS A INNER JOIN MARC AS B ON A~MATNR = B~MATNR
                                        INNER JOIN MARD AS C ON B~MATNR = C~MATNR AND
                                                                                B~WERKS = C~WERKS
WHERE A~MATNR IN S_MATNR " AND B~WERKS IN S_WERKS
AND B~XCHPF  'X' AND C~LABST > 0.

Max