<?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: Replacing Read with Loop will make a difference performance wise in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-read-with-loop-will-make-a-difference-performance-wise/m-p/11493515#M1932289</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Due to the 'greater than' you have to use the LOOP instead of the READ Statement.&lt;/P&gt;&lt;P&gt;Make sure the ITAB is defined as SORTED or HASHED TABLE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe it is an Option to first delete all entries from ITAB where F3 &amp;lt;= SF-F3.&lt;/P&gt;&lt;P&gt;Then you can use the READ Statement instead of the LOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have to verify with SAT-Transaction which Version is the better one for your case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Make also sure that the ITAB structure only contains fields you really Need in further processing.&lt;/P&gt;&lt;P&gt;Having an ITAB with a wide structure and millions of entries will also slow down Performance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 30 Dec 2015 12:31:22 GMT</pubDate>
    <dc:creator>bauert</dc:creator>
    <dc:date>2015-12-30T12:31:22Z</dc:date>
    <item>
      <title>Replacing Read with Loop will make a difference performance wise</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-read-with-loop-will-make-a-difference-performance-wise/m-p/11493513#M1932287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all, I have checked all the forums but i just have a doubt which i need to clarify. My basic requirement is to optimize the abap code which is written in BW Field Routine. I know that we cannot use Relational operator with Read Statement So, if we replace Read Statement with Loop Statement. Will it be same Performance wise. Because what i feel is it will loop multiple times which again will slow down the performance if we have millions records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Read table ITAB into WA With KEY&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; F1&amp;nbsp; = SF-F1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND&amp;nbsp; F2 =&amp;nbsp; SF-F2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND&amp;nbsp; F3 &amp;gt;&amp;nbsp; SF-F3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(ERROR as it does not accept relational Op)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RESULT = XYZ.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;****************************************************************************************************************************&lt;/P&gt;&lt;P&gt;LOOP AT ITAB ASSIGNING Field Symbol FS&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE&amp;nbsp; F1&amp;nbsp; = SF-F1&amp;nbsp; AND&amp;nbsp; F2 =&amp;nbsp; SF-F2&amp;nbsp; AND&amp;nbsp; F3 &amp;gt;&amp;nbsp; SF-F3. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RESULT = XYZ.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or Do we have any other alternative to replace read statement in a better way?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Matthew Billingham - fixed formatting (to an extent)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Dec 2015 11:04:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-read-with-loop-will-make-a-difference-performance-wise/m-p/11493513#M1932287</guid>
      <dc:creator>former_member391265</dc:creator>
      <dc:date>2015-12-30T11:04:06Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing Read with Loop will make a difference performance wise</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-read-with-loop-will-make-a-difference-performance-wise/m-p/11493514#M1932288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't know about the BW field routine,&amp;nbsp; but the read you are using there is for a standard table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are certain that your table does not have duplicate keys you can define it as a hashed table and read it using the 'WITH TABLE KEY' clause of the READ statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mind you,&amp;nbsp; if you have millions of records you will always have some sort of a delay.....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Dec 2015 11:18:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-read-with-loop-will-make-a-difference-performance-wise/m-p/11493514#M1932288</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-12-30T11:18:13Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing Read with Loop will make a difference performance wise</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-read-with-loop-will-make-a-difference-performance-wise/m-p/11493515#M1932289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Due to the 'greater than' you have to use the LOOP instead of the READ Statement.&lt;/P&gt;&lt;P&gt;Make sure the ITAB is defined as SORTED or HASHED TABLE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe it is an Option to first delete all entries from ITAB where F3 &amp;lt;= SF-F3.&lt;/P&gt;&lt;P&gt;Then you can use the READ Statement instead of the LOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have to verify with SAT-Transaction which Version is the better one for your case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Make also sure that the ITAB structure only contains fields you really Need in further processing.&lt;/P&gt;&lt;P&gt;Having an ITAB with a wide structure and millions of entries will also slow down Performance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Dec 2015 12:31:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-read-with-loop-will-make-a-difference-performance-wise/m-p/11493515#M1932289</guid>
      <dc:creator>bauert</dc:creator>
      <dc:date>2015-12-30T12:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing Read with Loop will make a difference performance wise</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-read-with-loop-will-make-a-difference-performance-wise/m-p/11493516#M1932290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This message was moderated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Dec 2015 14:15:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-read-with-loop-will-make-a-difference-performance-wise/m-p/11493516#M1932290</guid>
      <dc:creator>ArcherZhang</dc:creator>
      <dc:date>2015-12-30T14:15:16Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing Read with Loop will make a difference performance wise</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-read-with-loop-will-make-a-difference-performance-wise/m-p/11493517#M1932291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This message was moderated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Dec 2015 14:24:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-read-with-loop-will-make-a-difference-performance-wise/m-p/11493517#M1932291</guid>
      <dc:creator>Chintu6august</dc:creator>
      <dc:date>2015-12-30T14:24:25Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing Read with Loop will make a difference performance wise</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-read-with-loop-will-make-a-difference-performance-wise/m-p/11493518#M1932292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can simply EXIT loop after you find first line which meet WHERE criteria.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P&gt;LOOP AT itab WHERE a &amp;gt; b.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EXIT.&lt;/P&gt;
&lt;P&gt;ENDLOOP.&lt;/P&gt;
&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "found&lt;/P&gt;
&lt;P&gt;ELSE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "not found&lt;/P&gt;
&lt;P&gt;ENDIF.&lt;/P&gt;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;READ also searches whole table until it finds resulting line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have performance problem with that. Then use different kind of itab as already suggested, set itab key/s....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Dec 2015 14:40:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-read-with-loop-will-make-a-difference-performance-wise/m-p/11493518#M1932292</guid>
      <dc:creator>Tomas_Buryanek</dc:creator>
      <dc:date>2015-12-30T14:40:20Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing Read with Loop will make a difference performance wise</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-read-with-loop-will-make-a-difference-performance-wise/m-p/11493519#M1932293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since this thread is now attracting incorrect answers, I've decided to lock it. The answer has been given&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Use a SORTED or HASHED table, with key as defined as F1 F2&lt;/P&gt;&lt;P&gt;2. Put an EXIT before the ENDLOOP&lt;/P&gt;&lt;P&gt;3. Check sy-subrc after the ENDLOOP. If it is non-zero then no record was found&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Dec 2015 14:56:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-read-with-loop-will-make-a-difference-performance-wise/m-p/11493519#M1932293</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2015-12-30T14:56:29Z</dc:date>
    </item>
  </channel>
</rss>

