<?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 joining multiple tables in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/joining-multiple-tables/m-p/1548016#M248988</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;how to join 5 tables kna1,knvv,knb1,knvi and knvp all of customer master .I appreciate your response&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Aug 2006 20:03:09 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-08-29T20:03:09Z</dc:date>
    <item>
      <title>joining multiple tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/joining-multiple-tables/m-p/1548016#M248988</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;how to join 5 tables kna1,knvv,knb1,knvi and knvp all of customer master .I appreciate your response&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Aug 2006 20:03:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/joining-multiple-tables/m-p/1548016#M248988</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-29T20:03:09Z</dc:date>
    </item>
    <item>
      <title>Re: joining multiple tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/joining-multiple-tables/m-p/1548017#M248989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Priya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Join on more than 2 tables is always leads to low performance.&lt;/P&gt;&lt;P&gt;2) Its always better to perfrom a FOR ALL ENTRIES option.&lt;/P&gt;&lt;P&gt;3) Have a check whether internal table is empty or not before performing a FOR ALL ENTRIES option.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The below code has join upto 3 levels. This may help you in building join upto 5 levels.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARAMETERS: p_cityfr TYPE spfli-cityfrom, &lt;/P&gt;&lt;P&gt;            p_cityto TYPE spfli-cityto. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF wa, &lt;/P&gt;&lt;P&gt;         fldate TYPE sflight-fldate, &lt;/P&gt;&lt;P&gt;         carrname TYPE scarr-carrname, &lt;/P&gt;&lt;P&gt;         connid   TYPE spfli-connid, &lt;/P&gt;&lt;P&gt;       END OF wa. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA itab LIKE SORTED TABLE OF wa &lt;/P&gt;&lt;P&gt;               WITH UNIQUE KEY fldate carrname connid. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT c&lt;SUB&gt;carrname p&lt;/SUB&gt;connid f~fldate &lt;/P&gt;&lt;P&gt;       INTO CORRESPONDING FIELDS OF TABLE itab &lt;/P&gt;&lt;P&gt;       FROM ( ( scarr AS c &lt;/P&gt;&lt;P&gt;         INNER JOIN spfli AS p ON p&lt;SUB&gt;carrid   = c&lt;/SUB&gt;carrid &lt;/P&gt;&lt;P&gt;                              AND p~cityfrom = p_cityfr &lt;/P&gt;&lt;P&gt;                              AND p~cityto   = p_cityto ) &lt;/P&gt;&lt;P&gt;         INNER JOIN sflight AS f ON f&lt;SUB&gt;carrid = p&lt;/SUB&gt;carrid &lt;/P&gt;&lt;P&gt;                                AND f&lt;SUB&gt;connid = p&lt;/SUB&gt;connid ). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT itab INTO wa. &lt;/P&gt;&lt;P&gt;  WRITE: / wa-fldate, wa-carrname, wa-connid. &lt;/P&gt;&lt;P&gt;ENDLOOP. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vinay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Aug 2006 20:13:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/joining-multiple-tables/m-p/1548017#M248989</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-29T20:13:16Z</dc:date>
    </item>
    <item>
      <title>Re: joining multiple tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/joining-multiple-tables/m-p/1548018#M248990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Write the select query based on the following psudo code.&lt;/P&gt;&lt;P&gt;Add your new fields in Where condition as well on extraction fields and join condition as per your requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select a~&amp;lt;field1&amp;gt;&lt;/P&gt;&lt;P&gt;           b~&amp;lt;field2&amp;gt;&lt;/P&gt;&lt;P&gt;           c~&amp;lt;field3&amp;gt;&lt;/P&gt;&lt;P&gt;           d~&amp;lt;field4&amp;gt;&lt;/P&gt;&lt;P&gt;           e~&amp;lt;field5&amp;gt;&lt;/P&gt;&lt;P&gt;           from kna1 AS a	&lt;/P&gt;&lt;P&gt;          inner join knvv as b on a&lt;SUB&gt;kunnr  = b&lt;/SUB&gt;kunnr&lt;/P&gt;&lt;P&gt;          inner join knb1 as c on a&lt;SUB&gt;kunnr = c&lt;/SUB&gt;kunnr&lt;/P&gt;&lt;P&gt;          inner join knvi  as  d on a&lt;SUB&gt;kunnr = d&lt;/SUB&gt;kunnr&lt;/P&gt;&lt;P&gt;          inner join knvp as e on a&lt;SUB&gt;kunnr = e&lt;/SUB&gt;kunnr&lt;/P&gt;&lt;P&gt;          where a~kunnr in s_kunnr  AND&lt;/P&gt;&lt;P&gt;                     &amp;lt;cond2&amp;gt;   OR&lt;/P&gt;&lt;P&gt;                       etc,..&lt;/P&gt;&lt;P&gt;If you need more detail let me know your complete requirements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BtReddy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: B t&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Aug 2006 20:15:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/joining-multiple-tables/m-p/1548018#M248990</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-29T20:15:19Z</dc:date>
    </item>
    <item>
      <title>Re: joining multiple tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/joining-multiple-tables/m-p/1548019#M248991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Priyanka,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select a&lt;SUB&gt;f1 b&lt;/SUB&gt;f2 c&lt;SUB&gt;f3 D&lt;/SUB&gt;F4 E~F5&lt;/P&gt;&lt;P&gt;into table itab&lt;/P&gt;&lt;P&gt;from kna1 as a inner join knvv as b on a&lt;SUB&gt;f1 = b&lt;/SUB&gt;f1&lt;/P&gt;&lt;P&gt;inner join knb1 as c on a&lt;SUB&gt;f1 = c&lt;/SUB&gt;f1&lt;/P&gt;&lt;P&gt;inner join knvi as d on a&lt;SUB&gt;f1 = d&lt;/SUB&gt;f1&lt;/P&gt;&lt;P&gt;inner join knvp as e on a&lt;SUB&gt;f1 = e&lt;/SUB&gt;f1&lt;/P&gt;&lt;P&gt;where a~f1 = parameter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vivek&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Aug 2006 20:16:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/joining-multiple-tables/m-p/1548019#M248991</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-29T20:16:22Z</dc:date>
    </item>
  </channel>
</rss>

