<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: multiple left outer join in single select query in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/multiple-left-outer-join-in-single-select-query/m-p/4047001#M967382</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;good&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check this code and try accordingly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT *&lt;/P&gt;&lt;P&gt;FROM table1 AS t1&lt;/P&gt;&lt;P&gt;LEFT OUTER JOIN table2 AS t2 &lt;/P&gt;&lt;P&gt;ON t2&lt;SUB&gt;col2 = t1&lt;/SUB&gt;col2&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE result&lt;/P&gt;&lt;P&gt;WHERE t1~col1 IN so_col1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this will help you to solve your problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;mrutyun^&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 07 Jul 2008 12:13:24 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-07-07T12:13:24Z</dc:date>
    <item>
      <title>multiple left outer join in single select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/multiple-left-outer-join-in-single-select-query/m-p/4046999#M967380</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My client requires to apply multiple left outer join in single select query.&lt;/P&gt;&lt;P&gt;Tell me how it is possible . tell me if we can use native sql query.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jul 2008 11:34:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/multiple-left-outer-join-in-single-select-query/m-p/4046999#M967380</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-07T11:34:08Z</dc:date>
    </item>
    <item>
      <title>Re: multiple left outer join in single select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/multiple-left-outer-join-in-single-select-query/m-p/4047000#M967381</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vineet Kumar,&lt;/P&gt;&lt;P&gt;                           My suggestion would be better go for a VIEW. If u can't go for View's Use LDB this might solve ur issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Dheepak&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jul 2008 12:03:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/multiple-left-outer-join-in-single-select-query/m-p/4047000#M967381</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-07T12:03:33Z</dc:date>
    </item>
    <item>
      <title>Re: multiple left outer join in single select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/multiple-left-outer-join-in-single-select-query/m-p/4047001#M967382</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;good&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check this code and try accordingly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT *&lt;/P&gt;&lt;P&gt;FROM table1 AS t1&lt;/P&gt;&lt;P&gt;LEFT OUTER JOIN table2 AS t2 &lt;/P&gt;&lt;P&gt;ON t2&lt;SUB&gt;col2 = t1&lt;/SUB&gt;col2&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE result&lt;/P&gt;&lt;P&gt;WHERE t1~col1 IN so_col1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this will help you to solve your problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;mrutyun^&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jul 2008 12:13:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/multiple-left-outer-join-in-single-select-query/m-p/4047001#M967382</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-07T12:13:24Z</dc:date>
    </item>
    <item>
      <title>Re: multiple left outer join in single select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/multiple-left-outer-join-in-single-select-query/m-p/4047002#M967383</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI vineet,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using multile left join is possible but it reduce performance as it takes a long time to retrieve data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following code would help you in knowing how to use multiple left join&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT  test.

PARAMETERS:
  p_auart LIKE vbak-auart.

DATA:
  BEGIN OF fs_sales,
    auart LIKE vbak-auart,
    vbeln LIKE vbak-vbeln,
    posnr LIKE vbap-posnr,
    matnr LIKE vbap-matnr,
    netwr LIKE vbap-netwr,
  END OF fs_sales,
  fs_temp LIKE fs_sales.

DATA:
  t_sales LIKE STANDARD TABLE OF fs_sales.

SELECT k~auart
       k~vbeln
       p~posnr
       p~matnr
       p~netwr
  INTO TABLE t_sales
  FROM vbak AS k
  OUTER JOIN vbap AS p
  ON k~vbeln = p~vbeln
 WHERE auart = p_auart
   AND p~netwr LT 1000.


IF sy-subrc EQ 0.
  WRITE:/5 'Sales Document'(001),/,
        15 'Sales Document Item'(002),
        40 'Material Number'(003).

  sort t_sales by netwr ascending.
  LOOP AT t_sales INTO fs_sales.
    WRITE:/ fs_sales-vbeln under text-001.
    LOOP AT t_sales INTO fs_temp WHERE vbeln = fs_sales-vbeln.
      WRITE:/ fs_temp-posnr under text-002,
              fs_temp-matnr under text-003.
    ENDLOOP.
  ENDLOOP.
ELSE.
  MESSAGE 'No Record Found' TYPE 'I'.

ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But i would suggest you to go with views instead of using multiple joins..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best of luck,&lt;/P&gt;&lt;P&gt;Bhumika&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jul 2008 12:32:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/multiple-left-outer-join-in-single-select-query/m-p/4047002#M967383</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-07T12:32:25Z</dc:date>
    </item>
  </channel>
</rss>

