<?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: Performance issue in internal tables in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-internal-tables/m-p/2581106#M590204</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;When you execute a LOOP using WHERE condition, it will actually process all the rows from first row to Last row.&lt;/P&gt;&lt;P&gt;To Avoid this we have to use LOOP AT IT_VBAK from &amp;lt;row&amp;gt; .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this code .. it will surely improve the performance.&lt;/P&gt;&lt;P&gt;For eg IT_VBAK is my internal table with 10 lacks records .&lt;/P&gt;&lt;P&gt;But i want to process only records with KUNNR = 1000.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: V_START TYPE I.&lt;/P&gt;&lt;P&gt;DATA : V_KUNNR TYPE VBAK-KUNNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT IT_VBAK BY KUNNR.&lt;/P&gt;&lt;P&gt;READ TABLE IT_VBAK INTO WA_VBAK&lt;/P&gt;&lt;P&gt;   with KEY KUNNR = '0000001000'&lt;/P&gt;&lt;P&gt;   TRANPORTING NO FIELDS &lt;/P&gt;&lt;P&gt;   BINARY SEARCH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;  V_START = SY-TABIX.  "Capture the row position of first row &lt;/P&gt;&lt;P&gt;  V_KUNNR = WA_VBAK-KUNNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT IT_VBAK INTO WA_VBAK&lt;/P&gt;&lt;P&gt;                                From V_START.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; **Terminate the loop after the completion of the records for the KUNNR&lt;/P&gt;&lt;P&gt;     IF  WA_VBAK-KUNNR &amp;lt;&amp;gt; V_KUNNR.&lt;/P&gt;&lt;P&gt;       EXIT.&lt;/P&gt;&lt;P&gt;     ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**Process the records here       &lt;/P&gt;&lt;P&gt;WRITE:/ WA_VBAK-VBELN,&lt;/P&gt;&lt;P&gt;             WA_VBAK-VKORG.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   ENDLOOP.   &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Reward if Helpful&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 06 Aug 2007 12:47:06 GMT</pubDate>
    <dc:creator>varma_narayana</dc:creator>
    <dc:date>2007-08-06T12:47:06Z</dc:date>
    <item>
      <title>Performance issue in internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-internal-tables/m-p/2581099#M590197</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 am having an internal table with large volume (around 10  Lacs ) of records. Right now it has been sorted with required fields and using the same fileds in the where condtion of loop. But it is taking lot of time to read the records while loop the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please suggest the best way to read the internal table so that read time should be reduced. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Points will be assinged for the better soultions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks  in Advance,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chandra Mohan Vempati&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Aug 2007 12:13:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-internal-tables/m-p/2581099#M590197</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-06T12:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue in internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-internal-tables/m-p/2581100#M590198</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;use read statement&lt;/P&gt;&lt;P&gt;for example&lt;/P&gt;&lt;P&gt; READ TABLE &amp;lt;itab&amp;gt; INTO &amp;lt;wa&amp;gt; WITH KEY field = &amp;lt;value&amp;gt; using binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rgds,&lt;/P&gt;&lt;P&gt;bharat.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Aug 2007 12:15:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-internal-tables/m-p/2581100#M590198</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-06T12:15:32Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue in internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-internal-tables/m-p/2581101#M590199</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;first SORT the ITAB with Key fields&lt;/P&gt;&lt;P&gt;And READ the ITAB with the key fields using BINARY SEARCH&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Reward points for useful Answers&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Aug 2007 12:17:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-internal-tables/m-p/2581101#M590199</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-06T12:17:35Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue in internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-internal-tables/m-p/2581102#M590200</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chandra,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think u r executing loop in a loop and using where condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if it is really not needed ten use &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;: Read.....with binary search statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it will increase the performance of program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Krishnendu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Aug 2007 12:18:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-internal-tables/m-p/2581102#M590200</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-06T12:18:08Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue in internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-internal-tables/m-p/2581103#M590201</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;1. sort the internal table &lt;/P&gt;&lt;P&gt;2. delete the adjacent records with same name (if you don't want only )&lt;/P&gt;&lt;P&gt;3. after that loop at internal table &lt;/P&gt;&lt;P&gt;4. read the table based on the condition &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so it will execute so easyly &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward if usefull&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards &lt;/P&gt;&lt;P&gt;naresh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Aug 2007 12:18:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-internal-tables/m-p/2581103#M590201</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-06T12:18:16Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue in internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-internal-tables/m-p/2581104#M590202</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chandra Vempati,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Try to give where condition in the same order where  the fields available in table.&lt;/P&gt;&lt;P&gt;2. Try to give more selection condition if available / possible.&lt;/P&gt;&lt;P&gt;3. try to give where condition while looping.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   ex : loop at table where &amp;lt;condition&amp;gt;&lt;/P&gt;&lt;P&gt;         endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. Try to use secondary indexes.&lt;/P&gt;&lt;P&gt;5. inside the loop use READ with binary searches.&lt;/P&gt;&lt;P&gt;6. Sort before using the binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will help u.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if useful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with regards,&lt;/P&gt;&lt;P&gt;Murugan Arumugam.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Aug 2007 12:20:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-internal-tables/m-p/2581104#M590202</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-06T12:20:01Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue in internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-internal-tables/m-p/2581105#M590203</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;First sort the internal table.&lt;/P&gt;&lt;P&gt;Try to read with more conditions + Binary search.&lt;/P&gt;&lt;P&gt;With Regards,Jaheer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Aug 2007 12:34:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-internal-tables/m-p/2581105#M590203</guid>
      <dc:creator>jaheer_hussain</dc:creator>
      <dc:date>2007-08-06T12:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue in internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-internal-tables/m-p/2581106#M590204</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;When you execute a LOOP using WHERE condition, it will actually process all the rows from first row to Last row.&lt;/P&gt;&lt;P&gt;To Avoid this we have to use LOOP AT IT_VBAK from &amp;lt;row&amp;gt; .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this code .. it will surely improve the performance.&lt;/P&gt;&lt;P&gt;For eg IT_VBAK is my internal table with 10 lacks records .&lt;/P&gt;&lt;P&gt;But i want to process only records with KUNNR = 1000.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: V_START TYPE I.&lt;/P&gt;&lt;P&gt;DATA : V_KUNNR TYPE VBAK-KUNNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT IT_VBAK BY KUNNR.&lt;/P&gt;&lt;P&gt;READ TABLE IT_VBAK INTO WA_VBAK&lt;/P&gt;&lt;P&gt;   with KEY KUNNR = '0000001000'&lt;/P&gt;&lt;P&gt;   TRANPORTING NO FIELDS &lt;/P&gt;&lt;P&gt;   BINARY SEARCH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;  V_START = SY-TABIX.  "Capture the row position of first row &lt;/P&gt;&lt;P&gt;  V_KUNNR = WA_VBAK-KUNNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT IT_VBAK INTO WA_VBAK&lt;/P&gt;&lt;P&gt;                                From V_START.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; **Terminate the loop after the completion of the records for the KUNNR&lt;/P&gt;&lt;P&gt;     IF  WA_VBAK-KUNNR &amp;lt;&amp;gt; V_KUNNR.&lt;/P&gt;&lt;P&gt;       EXIT.&lt;/P&gt;&lt;P&gt;     ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**Process the records here       &lt;/P&gt;&lt;P&gt;WRITE:/ WA_VBAK-VBELN,&lt;/P&gt;&lt;P&gt;             WA_VBAK-VKORG.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   ENDLOOP.   &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Reward if Helpful&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Aug 2007 12:47:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-internal-tables/m-p/2581106#M590204</guid>
      <dc:creator>varma_narayana</dc:creator>
      <dc:date>2007-08-06T12:47:06Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue in internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-internal-tables/m-p/2581107#M590205</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;please read my comments on nested loops in the performance forum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A standard table is slow if used with loop at where, it does not matter whether it is sorted or not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Either you specify a sorted table, which is recommended, Or you use the binary search, index, loop from index, exit condition as explained also in the comment above.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S.: what is 10 Lacs? I know that it is a number, but don't remember how much it is.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Aug 2007 12:54:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-internal-tables/m-p/2581107#M590205</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-06T12:54:01Z</dc:date>
    </item>
  </channel>
</rss>

