<?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: read from internal table while looping thru it in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-from-internal-table-while-looping-thru-it/m-p/5489670#M1256379</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Pranati,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is no harm in uiing READ inside the LOOP for the same table.&lt;/P&gt;&lt;P&gt;But it depends on the purpose of your logic.&lt;/P&gt;&lt;P&gt;If by any case READ and LOOP are avoided then that approach should be followed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you can tell your requirement then it will be easier to guide you on this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 26 Apr 2009 07:27:27 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-04-26T07:27:27Z</dc:date>
    <item>
      <title>read from internal table while looping thru it</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-from-internal-table-while-looping-thru-it/m-p/5489667#M1256376</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;Is there any issues if i read a record from an internal table while looping thru it ? for eg,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab1 into itab1_wa.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read itab1 into itab1_wa1 with key field1 = itab1_wa-field2.&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;&lt;/P&gt;&lt;P&gt;thank you&lt;/P&gt;&lt;P&gt;pranati&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Apr 2009 06:56:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-from-internal-table-while-looping-thru-it/m-p/5489667#M1256376</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-26T06:56:18Z</dc:date>
    </item>
    <item>
      <title>Re: read from internal table while looping thru it</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-from-internal-table-while-looping-thru-it/m-p/5489668#M1256377</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Pranati,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I dont see any immediate issue, however, can relate to a concern regarding a possible issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What you could do is, move the contents of your itab1  into a temporary table itab2 before the loop starts using&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REFRESH itab2.
itab2[] = itab1[].&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then in your loop, READ TABLE itab2 instead of itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Aditya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Apr 2009 07:02:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-from-internal-table-while-looping-thru-it/m-p/5489668#M1256377</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-26T07:02:11Z</dc:date>
    </item>
    <item>
      <title>Re: read from internal table while looping thru it</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-from-internal-table-while-looping-thru-it/m-p/5489669#M1256378</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
Is there any issues if i read a record from an internal table while looping thru it ? for eg,
loop at itab1 into itab1_wa.
read itab1 into itab1_wa1 with key field1 = itab1_wa-field2.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;=&amp;gt; May be not good in performance:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may write smthing like &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
loop at itab1 where itab1-field EQ XYZ.
But for this you need to know XYZ.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise there is no problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank You&lt;/P&gt;&lt;P&gt;Shital&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Apr 2009 07:03:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-from-internal-table-while-looping-thru-it/m-p/5489669#M1256378</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-26T07:03:51Z</dc:date>
    </item>
    <item>
      <title>Re: read from internal table while looping thru it</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-from-internal-table-while-looping-thru-it/m-p/5489670#M1256379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Pranati,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is no harm in uiing READ inside the LOOP for the same table.&lt;/P&gt;&lt;P&gt;But it depends on the purpose of your logic.&lt;/P&gt;&lt;P&gt;If by any case READ and LOOP are avoided then that approach should be followed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you can tell your requirement then it will be easier to guide you on this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Apr 2009 07:27:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-from-internal-table-while-looping-thru-it/m-p/5489670#M1256379</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-26T07:27:27Z</dc:date>
    </item>
    <item>
      <title>Re: read from internal table while looping thru it</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-from-internal-table-while-looping-thru-it/m-p/5489671#M1256380</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;loop at itab1 into itab1_wa.&lt;/P&gt;&lt;P&gt;read itab1 into itab1_wa1 with key field1 = itab1_wa-field2.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is no issues with the code except for the values in work area.&lt;/P&gt;&lt;P&gt;when you read and assign values to same work area the value that you got in your work area while looping are gone.&lt;/P&gt;&lt;P&gt;So what you can do is use two work areas one for loop and other for read so that you can retain both values till the endloop line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Other than this you will have to check for conditions that you use.&lt;/P&gt;&lt;P&gt;Also if you want to have a check on performance sort the table and use binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Lalit Mohan Gupta.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Apr 2009 07:44:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-from-internal-table-while-looping-thru-it/m-p/5489671#M1256380</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-26T07:44:19Z</dc:date>
    </item>
  </channel>
</rss>

