<?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: Reducing Data base selection time in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/reducing-data-base-selection-time/m-p/6422532#M1409628</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vaddepati,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also dont use aggregate functions like &lt;STRONG&gt;SUM&lt;/STRONG&gt; . It also causes performance issues.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Abhii&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 Dec 2009 04:57:07 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-12-10T04:57:07Z</dc:date>
    <item>
      <title>Reducing Data base selection time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reducing-data-base-selection-time/m-p/6422530#M1409626</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 need to get the Excise Documnets which are not Billed. For that I've used following logic. But it is taking much time to get the data. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; SELECT a~exnum&lt;/P&gt;&lt;P&gt;         a~exyear&lt;/P&gt;&lt;P&gt;         a~exdat&lt;/P&gt;&lt;P&gt;         a~rdoc2&lt;/P&gt;&lt;P&gt;         SUM( a~exbed )&lt;/P&gt;&lt;P&gt;         SUM( a~ecs )&lt;/P&gt;&lt;P&gt;         SUM( a~exaddtax1 )&lt;/P&gt;&lt;P&gt;         b~vbtyp&lt;/P&gt;&lt;P&gt;         b~knumv&lt;/P&gt;&lt;P&gt;         b~bukrs&lt;/P&gt;&lt;P&gt;         b~kunrg&lt;/P&gt;&lt;P&gt;      FROM j_1iexcdtl AS a INNER JOIN vbrk AS b&lt;/P&gt;&lt;P&gt;      ON a&lt;SUB&gt;rdoc2 EQ b&lt;/SUB&gt;vbeln&lt;/P&gt;&lt;P&gt;      INTO TABLE lt_excise WHERE a~exdat IN s_fkdat      AND&lt;/P&gt;&lt;P&gt;                                 a~status EQ 'C'          AND&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                                a~exdat ge '20090401'   AND&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;                                 NOT EXISTS ( SELECT vbeln FROM vbrk WHERE vbeln EQ a~rdoc3 AND&lt;/P&gt;&lt;P&gt;                                                                           vbtyp EQ 'M' ) AND&lt;/P&gt;&lt;P&gt;                                 b~vbtyp EQ 'U'          AND&lt;/P&gt;&lt;P&gt;                                 b~bukrs IN s_bukrs      AND&lt;/P&gt;&lt;P&gt;                                 b~kunrg IN s_kunrg&lt;/P&gt;&lt;P&gt;                           GROUP BY a~exnum&lt;/P&gt;&lt;P&gt;                                    a~exyear&lt;/P&gt;&lt;P&gt;                                    a~exdat&lt;/P&gt;&lt;P&gt;                                    a~rdoc2&lt;/P&gt;&lt;P&gt;                                    b~vbtyp&lt;/P&gt;&lt;P&gt;                                    b~knumv&lt;/P&gt;&lt;P&gt;                                    b~bukrs&lt;/P&gt;&lt;P&gt;                                    b~kunrg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pl help to reduce the time for database selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rajiv. V&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Dec 2009 04:21:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reducing-data-base-selection-time/m-p/6422530#M1409626</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-12-10T04:21:42Z</dc:date>
    </item>
    <item>
      <title>Re: Reducing Data base selection time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reducing-data-base-selection-time/m-p/6422531#M1409627</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;Try to split this into two.&lt;/P&gt;&lt;P&gt;First try to fetch the sales order which are required.&lt;/P&gt;&lt;P&gt;Then use this sales order in second query to find excise related data with for example for all entries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will improve the performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sunny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Dec 2009 04:43:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reducing-data-base-selection-time/m-p/6422531#M1409627</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-12-10T04:43:55Z</dc:date>
    </item>
    <item>
      <title>Re: Reducing Data base selection time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reducing-data-base-selection-time/m-p/6422532#M1409628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vaddepati,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also dont use aggregate functions like &lt;STRONG&gt;SUM&lt;/STRONG&gt; . It also causes performance issues.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Abhii&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Dec 2009 04:57:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reducing-data-base-selection-time/m-p/6422532#M1409628</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-12-10T04:57:07Z</dc:date>
    </item>
    <item>
      <title>Re: Reducing Data base selection time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reducing-data-base-selection-time/m-p/6422533#M1409629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;Try this,&lt;/P&gt;&lt;P&gt;Firstly take data using select * from table command on transperent tables,&lt;/P&gt;&lt;P&gt;and within the loop use select single and read table commands&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Gaurav&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Dec 2009 05:13:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reducing-data-base-selection-time/m-p/6422533#M1409629</guid>
      <dc:creator>former_member329859</dc:creator>
      <dc:date>2009-12-10T05:13:07Z</dc:date>
    </item>
    <item>
      <title>Re: Reducing Data base selection time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reducing-data-base-selection-time/m-p/6422534#M1409630</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;To decrease the load on DB ,you can process Group by and SUM functions in Loop Endloop of resulting table.&lt;/P&gt;&lt;P&gt;Avoid using Subqueries with not condition.I read ,NOT compromises the index and starts linear search.&lt;/P&gt;&lt;P&gt;There are already many discussions on usage on For all entries and Join .So search forum for more details.&lt;/P&gt;&lt;P&gt;The performance of join and For all entries are context oriented.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SELECT a~exnum
a~exyear
a~exdat
a~rdoc2
SUM( a~exbed )                 "  Avoid using SUM use Control break in loop endloop
SUM( a~ecs )
SUM( a~exaddtax1 )
b~vbtyp
b~knumv
b~bukrs
b~kunrg
FROM j_1iexcdtl AS a INNER JOIN vbrk AS b
ON a~rdoc2 EQ b~vbeln   "Rdoc2 is available in secondary index ,I am not sure whether this affects the performance ,EXPERT advice is required     
INTO TABLE lt_excise WHERE a~exdat IN s_fkdat AND      
a~status EQ 'C' AND                             
* a~exdat ge '20090401' AND                 "if possible, try to use  indexed fields from VBRK 
NOT EXISTS ( SELECT vbeln FROM vbrk WHERE vbeln EQ a~rdoc3 AND   "Avoid using Not this would compromise the index or use Delete itab on resulting table
vbtyp EQ 'M' ) AND                                                                                
b~vbtyp EQ 'U' AND   
b~bukrs IN s_bukrs AND
b~kunrg IN s_kunrg
GROUP BY a~exnum                       " Avoid Group by 
a~exyear
a~exdat
a~rdoc2
b~vbtyp
b~knumv
b~bukrs
b~kunrg.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Dec 2009 05:15:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reducing-data-base-selection-time/m-p/6422534#M1409630</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-12-10T05:15:51Z</dc:date>
    </item>
  </channel>
</rss>

