<?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: Problem with Inner Join in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-inner-join/m-p/2779597#M647847</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When you want to optimize inner joins, then you must invest some time, use FOR ALL ENTRIES does noot help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You must check the primary keys and secondary key, if there are any, of all tables and figure out, which access would be must selective, i.e. reduce the results set most. And then you must check which table should be taken next and so on.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Depending on your situation such an analysis can be simple or very complicated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After figuring out, whether there is a good solution you must check what the database is actually doing. Use SQL Trace ... see a new blog under my name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In many cases gthe database is not doing to optimal access, then you can change the behavior of the database either by adding new indices or by using hints.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Sep 2007 07:54:32 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-09-07T07:54:32Z</dc:date>
    <item>
      <title>Problem with Inner Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-inner-join/m-p/2779594#M647844</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am new to SAP and have been told by all abapers that using joins is a major performance issue but in below select i am using inner join with key fields on the tables because if i don't use joins then i have to use loops which will again a performace issue so please suggest me that how in my case joins is a performance issue and if it is then what's best way to do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select&lt;/P&gt;&lt;P&gt;       vk~vbeln&lt;/P&gt;&lt;P&gt;       vk~erdat&lt;/P&gt;&lt;P&gt;       vk~vkgrp&lt;/P&gt;&lt;P&gt;       vk~kunnr&lt;/P&gt;&lt;P&gt;       vk~lifsk      " lifsk&lt;/P&gt;&lt;P&gt;       k1a~name1 as sotonm&lt;/P&gt;&lt;P&gt;       pa~kunnr as kunnr_pa&lt;/P&gt;&lt;P&gt;       k1b~name1 as shtonm&lt;/P&gt;&lt;P&gt;       vk~gwldt&lt;/P&gt;&lt;P&gt;       vk~vdatu&lt;/P&gt;&lt;P&gt;       vk~bstnk&lt;/P&gt;&lt;P&gt;       tv~bezei&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  from vbak as vk&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       inner join&lt;/P&gt;&lt;P&gt;       kna1 as k1a on vk&lt;SUB&gt;kunnr = k1a&lt;/SUB&gt;kunnr&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       inner join&lt;/P&gt;&lt;P&gt;       vbpa as pa on vk&lt;SUB&gt;vbeln = pa&lt;/SUB&gt;vbeln and&lt;/P&gt;&lt;P&gt;                     pa~parvw = 'WE' and&lt;/P&gt;&lt;P&gt;                     pa~posnr = ''&lt;/P&gt;&lt;P&gt;       inner join&lt;/P&gt;&lt;P&gt;       kna1 as k1b on pa&lt;SUB&gt;kunnr = k1b&lt;/SUB&gt;kunnr&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       inner join&lt;/P&gt;&lt;P&gt;       tvgrt as tv on vk&lt;SUB&gt;vkgrp = tv&lt;/SUB&gt;vkgrp&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  into corresponding fields of table ord_hdr&lt;/P&gt;&lt;P&gt;       where vk~lifsk in dblock.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Navdeep singh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2007 05:09:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-inner-join/m-p/2779594#M647844</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-07T05:09:22Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Inner Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-inner-join/m-p/2779595#M647845</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Navdeep ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instate of Inner Join used select for all enteries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Plz fellow this code and test it SE30 Tcode:Just Test Inner join Program and This code also , Plz let me known .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT SELECTION-SCREEN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT vbeln&lt;/P&gt;&lt;P&gt;         kunnr&lt;/P&gt;&lt;P&gt;         vkorg&lt;/P&gt;&lt;P&gt;         vtweg&lt;/P&gt;&lt;P&gt;         spart&lt;/P&gt;&lt;P&gt;    FROM vbak&lt;/P&gt;&lt;P&gt;    INTO TABLE it_vbak&lt;/P&gt;&lt;P&gt;   WHERE vbeln IN s_vbeln&lt;/P&gt;&lt;P&gt;     AND vkorg IN s_vkorg&lt;/P&gt;&lt;P&gt;     AND erdat IN s_erdat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF sy-subrc NE 0.&lt;/P&gt;&lt;P&gt;    MESSAGE ' NO RECORDS EXIST ! ' TYPE 'E'.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT vbeln&lt;/P&gt;&lt;P&gt;         posnr&lt;/P&gt;&lt;P&gt;         matnr&lt;/P&gt;&lt;P&gt;         brgew&lt;/P&gt;&lt;P&gt;         ntgew&lt;/P&gt;&lt;P&gt;         gewei&lt;/P&gt;&lt;P&gt;         netwr&lt;/P&gt;&lt;P&gt;         waerk&lt;/P&gt;&lt;P&gt;    FROM vbap&lt;/P&gt;&lt;P&gt;    INTO TABLE it_vbap&lt;/P&gt;&lt;P&gt;     FOR ALL ENTRIES IN it_vbak&lt;/P&gt;&lt;P&gt;    WHERE vbeln = it_vbak-vbeln .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT kunnr&lt;/P&gt;&lt;P&gt;         name1&lt;/P&gt;&lt;P&gt;         telf1&lt;/P&gt;&lt;P&gt;    FROM kna1&lt;/P&gt;&lt;P&gt;  INTO TABLE it_kna1&lt;/P&gt;&lt;P&gt;  FOR ALL ENTRIES IN it_vbak&lt;/P&gt;&lt;P&gt;  WHERE kunnr = it_vbak-kunnr .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nihar Swain .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2007 05:26:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-inner-join/m-p/2779595#M647845</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-07T05:26:29Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Inner Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-inner-join/m-p/2779596#M647846</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Navdeep,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is advisible not to use more than one inner join.&lt;/P&gt;&lt;P&gt;so use inner joins seperately and fill internal tables, then combine them using "for all entries".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For all entries can be used like:&lt;/P&gt;&lt;P&gt;SELECT kunnr&lt;/P&gt;&lt;P&gt;FROM kna1&lt;/P&gt;&lt;P&gt;INTO TABLE it_kna1&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN it_vbak&lt;/P&gt;&lt;P&gt;WHERE kunnr = it_vbak-kunnr .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sheron&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2007 05:45:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-inner-join/m-p/2779596#M647846</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-07T05:45:33Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Inner Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-inner-join/m-p/2779597#M647847</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When you want to optimize inner joins, then you must invest some time, use FOR ALL ENTRIES does noot help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You must check the primary keys and secondary key, if there are any, of all tables and figure out, which access would be must selective, i.e. reduce the results set most. And then you must check which table should be taken next and so on.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Depending on your situation such an analysis can be simple or very complicated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After figuring out, whether there is a good solution you must check what the database is actually doing. Use SQL Trace ... see a new blog under my name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In many cases gthe database is not doing to optimal access, then you can change the behavior of the database either by adding new indices or by using hints.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2007 07:54:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-inner-join/m-p/2779597#M647847</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-07T07:54:32Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Inner Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-inner-join/m-p/2779598#M647848</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Navdeep - please check these two:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;a href="http://blogs.ittoolbox.com/sap/db2/archives/for-all-entries-vs-db2-join-8912"&amp;gt;FOR ALL ENTRIES vs DB2 JOIN&amp;lt;/a&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;a href="/people/rob.burbank/blog/2007/03/19/joins-vs-for-all-entries--which-performs-better"&amp;gt;JOINS vs. FOR ALL ENTRIES - Which Performs Better?&amp;lt;/a&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2007 13:24:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-inner-join/m-p/2779598#M647848</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-07T13:24:51Z</dc:date>
    </item>
  </channel>
</rss>

