<?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 a huge query in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-a-huge-query/m-p/4180144#M999141</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Do not use aggregate functions at the database level. This will reduce performance hugely.&lt;/P&gt;&lt;P&gt;Select the fields into an internal table based on the where condition.&lt;/P&gt;&lt;P&gt;Loop at this internal table and use Collect stmt. This will be more efficient.&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;Subramanian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 14 Jul 2008 18:43:50 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-07-14T18:43:50Z</dc:date>
    <item>
      <title>problem with a huge query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-a-huge-query/m-p/4180141#M999138</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys, the following query ended with an error,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Possible errors:                                                     &lt;/P&gt;&lt;P&gt;  o The maximum size of an SQL statement has been exceeded.           &lt;/P&gt;&lt;P&gt;  o The statement contains too many input variables.                  &lt;/P&gt;&lt;P&gt;  o The space needed for the input data exceeds the available memory. &lt;/P&gt;&lt;P&gt;  o ...                                                               &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT SUM( erlos ) SUM( vv010 ) SUM( absmg )&lt;/P&gt;&lt;P&gt;    INTO (vtas, marg, v_pza)&lt;/P&gt;&lt;P&gt;    FROM ce1pisa&lt;/P&gt;&lt;P&gt;    where vrgar = 'F'&lt;/P&gt;&lt;P&gt;    AND perio IN r_periodo&lt;/P&gt;&lt;P&gt;    AND plikz = '0'&lt;/P&gt;&lt;P&gt;    AND bzirk  IN r_zonav&lt;/P&gt;&lt;P&gt;    AND kndnr  IN r_cliente&lt;/P&gt;&lt;P&gt;    AND kmmakl IN r_linea&lt;/P&gt;&lt;P&gt;    AND kmvkgr IN r_territorio&lt;/P&gt;&lt;P&gt;    AND vkorg  IN r_vkorg " ogr de ventas.&lt;/P&gt;&lt;P&gt;    AND bukrs  IN r_sociedad&lt;/P&gt;&lt;P&gt;    AND vtweg  IN r_canal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;r_vars are TYPE RANGE OF &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i needo to know what to do, because i really need to use this query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Jul 2008 18:35:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-a-huge-query/m-p/4180141#M999138</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-14T18:35:22Z</dc:date>
    </item>
    <item>
      <title>Re: problem with a huge query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-a-huge-query/m-p/4180142#M999139</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You need to be extra careful when using ranges in a select query.&lt;/P&gt;&lt;P&gt;There is a limitation on the maximum number of records that is allowed for range tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have faced this situation myself when one of the ranges had more than 2500 records. &lt;/P&gt;&lt;P&gt;I split the records and the select query ran fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;P&gt;Sushil Joshi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Jul 2008 18:40:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-a-huge-query/m-p/4180142#M999139</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-14T18:40:00Z</dc:date>
    </item>
    <item>
      <title>Re: problem with a huge query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-a-huge-query/m-p/4180143#M999140</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;Check whether there is any master table for ce1pisa if that is itself master table then check the entries of other fields in other table linked to master table with key if so...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select the master records into internal table.. and use FOR ALL ENTRIES in Second select query. This would be a good performance issue and your problem of huge query would be solved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Narin Nandivada.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Jul 2008 18:41:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-a-huge-query/m-p/4180143#M999140</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-14T18:41:52Z</dc:date>
    </item>
    <item>
      <title>Re: problem with a huge query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-a-huge-query/m-p/4180144#M999141</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Do not use aggregate functions at the database level. This will reduce performance hugely.&lt;/P&gt;&lt;P&gt;Select the fields into an internal table based on the where condition.&lt;/P&gt;&lt;P&gt;Loop at this internal table and use Collect stmt. This will be more efficient.&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;Subramanian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Jul 2008 18:43:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-a-huge-query/m-p/4180144#M999141</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-14T18:43:50Z</dc:date>
    </item>
  </channel>
</rss>

