<?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: Code Optimization for handling large volume of data in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884556#M933343</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do the read statements use Binary Search. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you using an index on the database table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Jun 2008 10:03:05 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-06-04T10:03:05Z</dc:date>
    <item>
      <title>Code Optimization for handling large volume of data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884543#M933330</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;&lt;/P&gt;&lt;P&gt;We are facing a problem when executing a report... lot of time is taken to execute..... Many a times the program is terminated with a dump that "Timeout :Program terminated because of endless loop".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the internal table which has to looped has more than 8.5 lac records...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and for each run of loop there are two read and one select statement (unavoidable)...,,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(We have followed almost all the optimization techniques,,,,)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please suggest if you have any idea as to ... what can be done in such situation....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sushil Hadge.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2008 09:18:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884543#M933330</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-04T09:18:30Z</dc:date>
    </item>
    <item>
      <title>Re: Code Optimization for handling large volume of data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884544#M933331</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try to run the report in background...since you told the select insode the loop is unaviodable...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reagrds&lt;/P&gt;&lt;P&gt;Shiva&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2008 09:20:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884544#M933331</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-04T09:20:26Z</dc:date>
    </item>
    <item>
      <title>Re: Code Optimization for handling large volume of data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884545#M933332</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;    C as you have said that some statements and loops are unavoidable, try running your program in the background. I guess u shudnt get a dump then. Try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Nayan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2008 09:20:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884545#M933332</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-04T09:20:56Z</dc:date>
    </item>
    <item>
      <title>Re: Code Optimization for handling large volume of data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884546#M933333</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;  You can avoid the select from the loop using SELECT FOR ALL ENTRIES. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds,&lt;/P&gt;&lt;P&gt;Bujji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2008 09:21:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884546#M933333</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-04T09:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: Code Optimization for handling large volume of data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884547#M933334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have already tried running it in background....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;still it takes lot of time.,.... i had scheduled for run on last night,,,,,now it has reached an execution time of 45000 secs... and it is still running...(Active)..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Sushil Hadge on Jun 4, 2008 2:55 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2008 09:24:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884547#M933334</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-04T09:24:34Z</dc:date>
    </item>
    <item>
      <title>Re: Code Optimization for handling large volume of data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884548#M933335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why is the select unavoidable. I would like to see the code. There are always alternatives.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2008 09:27:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884548#M933335</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-04T09:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: Code Optimization for handling large volume of data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884549#M933336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;8.5 lac = 850,000?&lt;/P&gt;&lt;P&gt;Nothing is really "unavoidable" in my humble experience, but you could start by posting the read and select statements here for further analysis. also include how you declared the internal tables that are being read.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2008 09:35:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884549#M933336</guid>
      <dc:creator>ThomasZloch</dc:creator>
      <dc:date>2008-06-04T09:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: Code Optimization for handling large volume of data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884550#M933337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Following is the piece of code.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

SELECT bukrs gpart hkont waers
      FROM dfkkop
      INTO TABLE it_dfkkop
      WHERE bukrs = p_bukrs AND bldat IN so_bldat AND hkont IN so_hkont.
.
SORT it_dfkkop BY gpart.
.
.
Loop at it_dfkkop into wa_dfkkop.
.
.
&amp;lt;Read statement&amp;gt;
.
&amp;lt;Read Statement&amp;gt;
.
.
ON CHANGE OF wa_dfkkop-gpart.
.
.

SELECT gpart hkont waers betrw FROM dfkkop INTO TABLE it_subtot WHERE hkont = wa_dfkkop-hkont AND gpart = wa_dfkkop-gpart.
.
.
      IF it_subtot IS NOT INITIAL.

        LOOP AT it_subtot INTO wa_subtot.

          v_sum = v_sum + wa_subtot-betrw.

        ENDLOOP.
     Endif.  

Endon.
.
.
Endloop.


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please suggest if this can be improved in some way....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks ,&lt;/P&gt;&lt;P&gt;Sushil&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Sushil Hadge on Jun 4, 2008 3:12 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2008 09:41:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884550#M933337</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-04T09:41:21Z</dc:date>
    </item>
    <item>
      <title>Re: Code Optimization for handling large volume of data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884551#M933338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why are you reading table dfkkop twice. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How many records are actaully on this table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2008 09:45:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884551#M933338</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-04T09:45:19Z</dc:date>
    </item>
    <item>
      <title>Re: Code Optimization for handling large volume of data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884552#M933339</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes Thomas .... around 850,000 records....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2008 09:46:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884552#M933339</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-04T09:46:25Z</dc:date>
    </item>
    <item>
      <title>Re: Code Optimization for handling large volume of data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884553#M933340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Table dfkkop  has large number of records....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;after the first select query ....the internal table it_dfkkop has about 8,50,000 records...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For each unique gpart value.... there is a subtotal to be calculated across the table which incudes the reading of records .. which do not form part of the output....&lt;/P&gt;&lt;P&gt;   it is a little complicated....hope it is clear,,,,,,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sushil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2008 09:52:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884553#M933340</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-04T09:52:47Z</dc:date>
    </item>
    <item>
      <title>Re: Code Optimization for handling large volume of data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884554#M933341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I also would be concerned about any report that needs to process 8.5 million (I guess lac means million) records on each run and takes over 12 hours to run.   What sort of data are you reporting on that you need to do this?  You can't be displaying all 8.5 million records on your output so you must be doing some kind of consolidation; is there any way you can record the results of this consolidation in a custom table so that you can 'resuse' some of the output of a previous run in the next run and not have to start it all again from scratch?  Or is there some way you can break the report down so that it doesn't have to do everything in a single loop?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's a bit difficult to suggest anything without knowing anything about your data.  I'd go and have another look at the report and see if there is a way to reorganise what it is doing - and there are always options to do things differently.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2008 09:53:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884554#M933341</guid>
      <dc:creator>christine_evans</dc:creator>
      <dc:date>2008-06-04T09:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: Code Optimization for handling large volume of data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884555#M933342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Christine  ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The number of records are huge.. bcoz...the report is a Yearly report....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The report will be executed in the background.... and then a file will be created from the spool....and placed on the application server..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the program is working fine for 60000 to 80000 records........&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i am also trying to find a way to either optimize if possible ... or to breakdown the Report/Loop... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;Sushil.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2008 10:00:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884555#M933342</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-04T10:00:04Z</dc:date>
    </item>
    <item>
      <title>Re: Code Optimization for handling large volume of data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884556#M933343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do the read statements use Binary Search. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you using an index on the database table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2008 10:03:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884556#M933343</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-04T10:03:05Z</dc:date>
    </item>
    <item>
      <title>Re: Code Optimization for handling large volume of data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884557#M933344</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No i am not using index on database table...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i am not aware of that concept.&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;Sushil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2008 10:08:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884557#M933344</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-04T10:08:45Z</dc:date>
    </item>
    <item>
      <title>Re: Code Optimization for handling large volume of data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884558#M933345</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The fields you are using on the WHERE statement. Do they may to an existing index on the table. Ask your basis team to look. If there is not one, then this will certainly slow down the processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also are you using the command BINARY SEARCH for the READ statements. If not you should be using these also. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What key is the READ statemen using. Do you need to do it for each iteration of the LOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2008 10:11:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884558#M933345</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-04T10:11:01Z</dc:date>
    </item>
    <item>
      <title>Re: Code Optimization for handling large volume of data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884559#M933346</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; Hi Martin,&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; No i am not using index on database table...&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; i am not aware of that concept.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Thanks ,&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Sushil&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But you must know about database indexes if, as you say, you have used all the optimization techniques.  We don't seem to have this table in our 4.7 R/3 system so I can't comment on indexes.  But, I'd get rid of that second select and make sure that you first select contains all the data needed to calculate the totals and work with that instead.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Even with 8.5 million records, a program like this should not take 12 plus hours to run and I bet it is that second select that is the problem.  Is DFKKOP indexed on HKONT or GBPART?  If it is indexed on GBPART does BUKRS (which you're not using in the second select) come before it in the index?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2008 10:33:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884559#M933346</guid>
      <dc:creator>christine_evans</dc:creator>
      <dc:date>2008-06-04T10:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: Code Optimization for handling large volume of data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884560#M933347</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;no currently i am not using a binary search.... i will change that now...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for suggesting...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes Read statement is required for each iteration.....&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;&lt;/P&gt;&lt;P&gt;Sushil.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2008 10:34:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884560#M933347</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-04T10:34:35Z</dc:date>
    </item>
    <item>
      <title>Re: Code Optimization for handling large volume of data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884561#M933348</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you post the code for the read statements also. Even though you say they are needed for each iteration. Do you just mean the data is needed or does the key fields you are using change for each pass of the loop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2008 10:36:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884561#M933348</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-04T10:36:41Z</dc:date>
    </item>
    <item>
      <title>Re: Code Optimization for handling large volume of data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884562#M933349</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Christine ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also feel that second select is the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will remove the second select get all the data from dfkkop that is necessary and &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do a Loop in Loop.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--Sushil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2008 10:38:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-optimization-for-handling-large-volume-of-data/m-p/3884562#M933349</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-04T10:38:57Z</dc:date>
    </item>
  </channel>
</rss>

