‎2008 Aug 19 10:30 AM
hi all ,I have this code:
SELECT afkoaufnr afkogltrp afkogstrp aufkobjnr afpoamein afpodauat afpodwerk afpomatnr afpo~psmng
afpowemng resbbdmng resbmeins maraprdha maktmaktx marczzprtnd
INTO TABLE int_tab
FROM ( afko
INNER JOIN aufk
ON aufkaufnr = afkoaufnr
INNER JOIN afpo
ON afpoaufnr = afkoaufnr
INNER JOIN resb
ON resbaufnr = afpoaufnr
INNER JOIN mara
ON maramatnr = afpomatnr
INNER JOIN makt
ON maktmatnr = afpomatnr
INNER JOIN marc
ON marcmatnr = afpomatnr )
WHERE afko~gstrp = '20080801'
AND afpo~dauat = 'ZP01'
AND afpo~dwerk = '4801'.
why there are same records for the same afko~aufnr ?
for example, the afko~aufnr = 1000301
there is only 1 record in afpo when aufnr 1000301
and only 1 record in resb when 1000301.
this is the code from the query, so I can't modify the code to delete the duplicate record. maybe I should modify the table join, but how should I do?
‎2008 Aug 19 2:21 PM
You should add MAKTSPRAS = SY-LANGU and MARCWERKS = AFPO~DWERK to the ON-conditions.
Even after that, the join on RESB is problematic, since no index is used and any number of RESB entries with a matching AUFNR could be returned.
Thomas
‎2008 Aug 19 2:21 PM
You should add MAKTSPRAS = SY-LANGU and MARCWERKS = AFPO~DWERK to the ON-conditions.
Even after that, the join on RESB is problematic, since no index is used and any number of RESB entries with a matching AUFNR could be returned.
Thomas