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

about Join

Former Member
0 Likes
679

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?

1 ACCEPTED SOLUTION
Read only

ThomasZloch
Active Contributor
0 Likes
547

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

1 REPLY 1
Read only

ThomasZloch
Active Contributor
0 Likes
548

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