<?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 Can I put Read inside loop? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/can-i-put-read-inside-loop/m-p/2837608#M664489</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Folks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can I put Read inside loop?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Performance wise is it acceptable?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sreeram&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 28 Sep 2007 05:27:37 GMT</pubDate>
    <dc:creator>sreeramkumar_madisetty</dc:creator>
    <dc:date>2007-09-28T05:27:37Z</dc:date>
    <item>
      <title>Can I put Read inside loop?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/can-i-put-read-inside-loop/m-p/2837608#M664489</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Folks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can I put Read inside loop?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Performance wise is it acceptable?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sreeram&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Sep 2007 05:27:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/can-i-put-read-inside-loop/m-p/2837608#M664489</guid>
      <dc:creator>sreeramkumar_madisetty</dc:creator>
      <dc:date>2007-09-28T05:27:37Z</dc:date>
    </item>
    <item>
      <title>Re: Can I put Read inside loop?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/can-i-put-read-inside-loop/m-p/2837609#M664490</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OF COURSE U CAN PUT READ IN THE LOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for performance...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;be sure for follwing things...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort the table with the key fields on which u r putting read.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then write the following code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE IT INTO WA WITH KEY XYZ = '  ' BINARY SEARCH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REWARD POINTS PLEASE...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Sep 2007 05:29:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/can-i-put-read-inside-loop/m-p/2837609#M664490</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-28T05:29:33Z</dc:date>
    </item>
    <item>
      <title>Re: Can I put Read inside loop?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/can-i-put-read-inside-loop/m-p/2837610#M664491</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ya sree ram.. it is absoulatelty fine to put read inside the loop..&lt;/P&gt;&lt;P&gt;just avoid nested loop for better performance..&lt;/P&gt;&lt;P&gt;reward if useful..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Sep 2007 05:33:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/can-i-put-read-inside-loop/m-p/2837610#M664491</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-28T05:33:38Z</dc:date>
    </item>
    <item>
      <title>Re: Can I put Read inside loop?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/can-i-put-read-inside-loop/m-p/2837611#M664492</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;well ofcourse you can use it, however as far as performance is concerned, its better to use "FOR ALL ENTRIES".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please reward the helpful entries.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raman.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Sep 2007 05:41:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/can-i-put-read-inside-loop/m-p/2837611#M664492</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-28T05:41:39Z</dc:date>
    </item>
    <item>
      <title>Re: Can I put Read inside loop?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/can-i-put-read-inside-loop/m-p/2837612#M664493</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sort itab2 by field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP at itab1.&lt;/P&gt;&lt;P&gt;itab_final-field2 = itab1-field2.&lt;/P&gt;&lt;P&gt;read table itab2 with key field = itab1-field binary search.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;itab_final-field1 = itab2-field1.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;append itab_final.&lt;/P&gt;&lt;P&gt;clear itab_final.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is how generally we populate final internal table with data from more than one internal tables. Performance wise this is better.&lt;/P&gt;&lt;P&gt;Sort and reading with binary search is effective.&lt;/P&gt;&lt;P&gt;And using read in loop is effective that loop inside a loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Vasu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Sep 2007 08:57:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/can-i-put-read-inside-loop/m-p/2837612#M664493</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-28T08:57:38Z</dc:date>
    </item>
    <item>
      <title>Re: Can I put Read inside loop?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/can-i-put-read-inside-loop/m-p/2837613#M664494</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;there is no problem to put READ statement inside the LOOP &lt;/P&gt;&lt;P&gt;its a better way to put &lt;/P&gt;&lt;P&gt;to avoid SELECT in a LOOP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;see this example &lt;/P&gt;&lt;P&gt;i had used that in my program &lt;/P&gt;&lt;P&gt;in the performance point of view it is a good method&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT IT_SOBID INTO WA_SOBID." where otype eq s_otype and objid eq s_objid.

    READ TABLE IT_HRP1026 WITH KEY OBJID = WA_SOBID-SOBID OTYPE = WA_SOBID-SCLAS INTO WA_HRP1026.
    IF SY-SUBRC EQ 0.
      READ TABLE IT_HRP1000 WITH KEY OBJID = WA_SOBID-SOBID INTO WA_HRP1000.

      WA_OUTPUT-OBJID = WA_HRP1026-OBJID.
      WA_OUTPUT-BEGDA = WA_SOBID-BEGDA.
      WA_OUTPUT-ENDDA = WA_SOBID-ENDDA.
      WA_OUTPUT-AEDTM = WA_HRP1026-AEDTM.
      WA_OUTPUT-UNAME = WA_HRP1026-UNAME.
      WA_OUTPUT-STEXT = WA_HRP1000-STEXT.

      READ TABLE IT_REASON WITH KEY CANCR = WA_HRP1026-CANCR INTO WA_REASON.

      WA_OUTPUT-CANCRT = WA_REASON-CANCRT.
      CLEAR WA_REASON-CANCRT.

      READ TABLE IT_LOCATION1 WITH KEY OBJID = WA_HRP1026-OBJID INTO WA_LOCATION1..

      READ TABLE IT_LSTEXT WITH KEY OBJID = WA_LOCATION1-SOBID OTYPE = 'F' INTO WA_LSTEXT.

             WA_OUTPUT-LSTEXT = WA_LSTEXT-LSTEXT.
             CLEAR WA_LSTEXT-LSTEXT.


      APPEND WA_OUTPUT TO IT_OUTPUT.
      CLEAR WA_OUTPUT.
      CLEAR WA_OUTPUT-CANCRT.
    ENDIF.
  ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Reward if usefull&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Sep 2007 09:05:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/can-i-put-read-inside-loop/m-p/2837613#M664494</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-28T09:05:18Z</dc:date>
    </item>
    <item>
      <title>Re: Can I put Read inside loop?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/can-i-put-read-inside-loop/m-p/2837614#M664495</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,,&lt;/P&gt;&lt;P&gt; s u can ..&lt;/P&gt;&lt;P&gt; performance vise is best too...&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; baskaran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Sep 2007 09:07:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/can-i-put-read-inside-loop/m-p/2837614#M664495</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-28T09:07:40Z</dc:date>
    </item>
  </channel>
</rss>

