<?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: join statement. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-statement/m-p/6066433#M1354751</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;Please use Views instead of joins.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Or Use seperate select query join for vbak and vbap and seperate query for ztable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Avoid using left outer joins.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nandha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 16 Sep 2009 11:32:37 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-09-16T11:32:37Z</dc:date>
    <item>
      <title>join statement.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-statement/m-p/6066432#M1354750</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;I have given following statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select  vbak~vbeln&lt;/P&gt;&lt;P&gt;          vbak~bstdk&lt;/P&gt;&lt;P&gt;          vbak~bstnk&lt;/P&gt;&lt;P&gt;          vbak~knumv&lt;/P&gt;&lt;P&gt;          vbak~lifsk&lt;/P&gt;&lt;P&gt;          vbak~augru&lt;/P&gt;&lt;P&gt;          vbak~erdat&lt;/P&gt;&lt;P&gt;          vbak~spart&lt;/P&gt;&lt;P&gt;          vbak~vkbur&lt;/P&gt;&lt;P&gt;          vbap~arktx&lt;/P&gt;&lt;P&gt;          zro_downpayment~branch_date&lt;/P&gt;&lt;P&gt;          zro_downpayment~bldat&lt;/P&gt;&lt;P&gt;          zro_downpayment~belnr&lt;/P&gt;&lt;P&gt;          zro_downpayment~payment_scheme&lt;/P&gt;&lt;P&gt;          zro_downpayment~payable_to&lt;/P&gt;&lt;P&gt;          zro_downpayment~payment_method&lt;/P&gt;&lt;P&gt;          zro_downpayment~contract&lt;/P&gt;&lt;P&gt;          zro_downpayment~payee&lt;/P&gt;&lt;P&gt;          zro_downpayment~supplier&lt;/P&gt;&lt;P&gt;          zro_downpayment~soldto&lt;/P&gt;&lt;P&gt;        into table it_vbak&lt;/P&gt;&lt;P&gt;        from vbak left outer join vbap            on vbak&lt;SUB&gt;vbeln = vbap&lt;/SUB&gt;vbeln&lt;/P&gt;&lt;P&gt;                  left outer join zro_downpayment on vbak&lt;SUB&gt;vbeln = zro_downpayment&lt;/SUB&gt;vbeln&lt;/P&gt;&lt;P&gt;        where vbak~erdat in s_erdat&lt;/P&gt;&lt;P&gt;          and vbak~lifsk eq c_lifsk1&lt;/P&gt;&lt;P&gt;          and vbak~vkorg eq p_vkorg&lt;/P&gt;&lt;P&gt;          and vbak~vtweg in s_vtweg&lt;/P&gt;&lt;P&gt;          and vbak~spart in s_spart&lt;/P&gt;&lt;P&gt;          and vbak~vkbur in s_off.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in the above statement vbak&lt;SUB&gt;erdat is used only 15-20% time i.e. user generally does not enter values in s_erdat.  Index of vbak is on erdat field.  Can you please guide me how to tune this statement to avoid vbak&lt;/SUB&gt;erdat and use different where clause so that program is executed efficiently.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Santosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Sep 2009 10:57:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-statement/m-p/6066432#M1354750</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-16T10:57:47Z</dc:date>
    </item>
    <item>
      <title>Re: join statement.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-statement/m-p/6066433#M1354751</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;Please use Views instead of joins.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Or Use seperate select query join for vbak and vbap and seperate query for ztable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Avoid using left outer joins.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nandha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Sep 2009 11:32:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-statement/m-p/6066433#M1354751</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-16T11:32:37Z</dc:date>
    </item>
    <item>
      <title>Re: join statement.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-statement/m-p/6066434#M1354752</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Santosh , &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As per my understanding of your logic , you need to fetch records from zro_downpayment based on VBAK and VBAP entries based on some conditions , &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are many ways to do the same , you need to identify the best in your case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can first fetch the records from VBAK and VBAP in one go in an internal table .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now get the unique VBELN from this internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use FOR ALL ENTRIES to fetch records from database table zro_downpayment .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, collect all the records in resultant internal table .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note : This can increase the code processing time , but will reduce time for database operation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, use of join with more than 2 tables  should not be prefered.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Sep 2009 11:47:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-statement/m-p/6066434#M1354752</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-16T11:47:18Z</dc:date>
    </item>
    <item>
      <title>Re: join statement.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-statement/m-p/6066435#M1354753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Use FOR ALL ENTRIES to fetch records from database table zro_downpayment .&lt;/P&gt;&lt;P&gt;&amp;gt; Note : This can increase the code processing time , but will reduce time for database operation.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Also, use of join with more than 2 tables  should not be prefered.&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm curious to know how you came to this conclusion that Join is not preffered for more than 2 tables and FOR ALL entries is better in database operation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Advait&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Sep 2009 12:12:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-statement/m-p/6066435#M1354753</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-16T12:12:29Z</dc:date>
    </item>
    <item>
      <title>Re: join statement.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-statement/m-p/6066436#M1354754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A few pointers&lt;/P&gt;&lt;P&gt;- You've joined VBAK and VBAP , but are not selecting the posnr field anywhere. This may lead to inconsistencies. &lt;/P&gt;&lt;P&gt;- There is no index on VBAP so it is diffcult to refine your query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Apart from that since you are using an outer join, the db system creates a temporary table with all the records as per the ON condition, then fetch all remaining records from the left hand side table and put zero values in the fields of the right hand side table. And then applies the where condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thus for outer joins,the number of records fetched will be higher if the fields in the where clause are left blank.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Only thing that I can think of it to make the erdat mandatory. But not a very good solution perhaps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope someone can come up with a better solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Advait&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Sep 2009 12:53:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-statement/m-p/6066436#M1354754</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-16T12:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: join statement.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/join-statement/m-p/6066437#M1354755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Santosh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have told us that the user only enters ERDAT 15-20% of the time however you have not told us what the user enters most of the time. Usually you need to inform your users that they cannot run the report open (without any selection criteria) online. If they insist on doing that tell them to run the program in the background. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With regards to VBAK you don't have much choice. SAP provides secondary indexes in ERDAT and AUDAT in addition to the primary index on VBELN. You need to talk to you users and explain to them this problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Sep 2009 22:43:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/join-statement/m-p/6066437#M1354755</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-16T22:43:51Z</dc:date>
    </item>
  </channel>
</rss>

