Skip to Content
0
Former Member
Dec 21, 2007 at 11:19 AM

JOIN Statement alternatives

68 Views

Hi folks, I have a problem with a join statement.basically i am trying to read GL Document data.I have the statement below but when it searches in table PPOIX it only retrieves the first match it finds based on pp0ix-runid = ppdix-runid and pp0ix-tslin = ppdix-linum.What i want to do is get all tslin for each linum found in ppdix. if i leave out pp0ix-tslin = ppdix-linum then i will get every line per runid but i just want lines that are found in ppdix.

SELECT DISTINCT ppdit~hkont

ppdit~kostl

ppoix~pernr

ppoix~betrg

ppoix~waers

INTO TABLE gt_gl_lines

FROM ppdit

JOIN ppdix ON ppdixdocnum = ppditdocnum

AND ppdixdoclin = ppditdoclin

JOIN ppoix ON ppoixrunid = ppdixrunid

AND ppoixtslin = ppdixlinum

WHERE ppdix~runid = gs_gl_docs-runid

AND ppdit~docnum = gs_gl_docs-docnum

AND ppdit~kostl = l_kostl_new.

Edited by: Damien Kesle on Dec 21, 2007 12:21 PM