02-23-2024 3:47 PM - edited 02-24-2024 11:59 AM
Hi There!
I wrote this query to achieve the attached output... But it is giving me improper/duplicated results. The data have 464 rows but i'm getting 1008 rows. Kindly let me know what mistake I made in the join conditions. Thanks in advance.
select distinct T001L.LGORT as sloc,MKPF.BUDAT as Year,MKPF.XBLNR as ReferenceDoc,MKPF.XABLN as GRGISlip,
MSEG.BWART as MovementType,MSEG.SHKZG as DC,
(select case MSEG.SHKZG when 'S' then MSEG.MENGE else 0.0 end) as Receipt,
(select case MSEG.SHKZG when 'H' then MSEG.MENGE else 0.0 end) as Issue,
MSEG.DMBTR as Amount,MSEG.MENGE as BalQuantity,
MBEW.VERPR as PricePerUnit, MBEW.SALK3 as BalanceAmount,
t156t.BTEXT as Comment from mara
INNER join mseg on
mara.MATNR=mseg.MATNR
INNER join t001l
on t001l.LGORT=mseg.LGORT
INNER join mkpf
on mkpf.MBLNR=mseg.MBLNR
INNER join mard
on mard.MATNR=MARA.MATNR
INNER join mbew
on mbew.MATNR=MARA.MATNR
AND MBEW.LVORM=MARA.LVORM
INNER JOIN t156t
ON t156t.bwart = mseg.bwart
AND t156t.sobkz = mseg.sobkz
AND t156t.kzbew = mseg.kzbew
AND t156t.kzzug = mseg.kzzug
AND t156t.kzvbr = mseg.kzvbr
where
MARA.MATNR='1L90MHVB10250A'
and (MKPF.budat between '20200101' and '20231231')
and MSEG.BUKRS='VN01' and MSEG.WERKS='VNSD' AND t001l.lgort='RM01'and t156t.SPRAS='E' ;
User | Count |
---|---|
70 | |
8 | |
8 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.