<?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 and Loop in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-and-loop/m-p/4194963#M1002708</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use the READ statement to read the particular record of the table based on a key parameter or based on index.&lt;/P&gt;&lt;P&gt;READ alwaye returns only one record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To process/access multiple records use the LOOP statemnt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Look at the below example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF internal table ITAB Has two fields CARRID and CONNID.&lt;/P&gt;&lt;P&gt;It contains the following records&lt;/P&gt;&lt;P&gt;CARRID     CONNID&lt;/P&gt;&lt;P&gt;AA             01&lt;/P&gt;&lt;P&gt;AA             02&lt;/P&gt;&lt;P&gt;AA             03&lt;/P&gt;&lt;P&gt;AB             10&lt;/P&gt;&lt;P&gt;AB             11  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want a record with carrid = 'AA' and connid = '03', use the READ stament as READ TABLE ITAB WITH KEY CARRID = 'AA' CONNID = '03'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to access the records with carrid 'AA', use loop statement.&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;Rajinikanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 16 Jul 2008 08:54:15 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-07-16T08:54:15Z</dc:date>
    <item>
      <title>Read and Loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-and-loop/m-p/4194962#M1002707</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;Can anyone tell me the differences between READ loop and LOOP loop?&lt;/P&gt;&lt;P&gt;And in which condition I should use READ ?&lt;/P&gt;&lt;P&gt;In which condition I should use LOOP?&lt;/P&gt;&lt;P&gt;In which condition I should use both?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much!&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;Fiona&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jul 2008 08:44:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-and-loop/m-p/4194962#M1002707</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-16T08:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: Read and Loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-and-loop/m-p/4194963#M1002708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use the READ statement to read the particular record of the table based on a key parameter or based on index.&lt;/P&gt;&lt;P&gt;READ alwaye returns only one record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To process/access multiple records use the LOOP statemnt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Look at the below example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF internal table ITAB Has two fields CARRID and CONNID.&lt;/P&gt;&lt;P&gt;It contains the following records&lt;/P&gt;&lt;P&gt;CARRID     CONNID&lt;/P&gt;&lt;P&gt;AA             01&lt;/P&gt;&lt;P&gt;AA             02&lt;/P&gt;&lt;P&gt;AA             03&lt;/P&gt;&lt;P&gt;AB             10&lt;/P&gt;&lt;P&gt;AB             11  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want a record with carrid = 'AA' and connid = '03', use the READ stament as READ TABLE ITAB WITH KEY CARRID = 'AA' CONNID = '03'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to access the records with carrid 'AA', use loop statement.&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;Rajinikanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jul 2008 08:54:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-and-loop/m-p/4194963#M1002708</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-16T08:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: Read and Loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-and-loop/m-p/4194964#M1002709</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi..&lt;/P&gt;&lt;P&gt;Read will fetch u a single record of an internal table where as Loop will make u able to access all the rows of the internal table....&lt;/P&gt;&lt;P&gt;suppose u have a table itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then &lt;/P&gt;&lt;P&gt;read table itab into wa_itab index 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;will make u having the value of the first row of the interanl table in wa_itab, wa_itab is a work area of the type same as itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or u can use&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table itab into wa_itab with key field1 = co_value1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here u can get a perticular record where field1 is having a value of co_value1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab into wa_itab.&lt;/P&gt;&lt;P&gt;:&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;here inside loop...endloop u will have all the recods one by one in wa_itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;put a break point inside loop....endloop then u can see how values are coming in to wa_itab. in the loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Rudra Prasanna Mohapatra on Jul 16, 2008 11:00 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jul 2008 09:00:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-and-loop/m-p/4194964#M1002709</guid>
      <dc:creator>former_member195383</dc:creator>
      <dc:date>2008-07-16T09:00:43Z</dc:date>
    </item>
    <item>
      <title>Re: Read and Loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-and-loop/m-p/4194965#M1002710</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;In programming practice, we do come across some situations where in we need to find whether a particular record is existing in a table or not .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In such cases we need to use READ statement to find out whether the record is vailable or not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the record is available then the return code will be 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case LOOP also works but performancewise READ is better.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ram&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jul 2008 09:07:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-and-loop/m-p/4194965#M1002710</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-16T09:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: Read and Loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-and-loop/m-p/4194966#M1002711</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When you try catch one record use READ statement,&lt;/P&gt;&lt;P&gt;When you want retrieved all the record use loop statement.&lt;/P&gt;&lt;P&gt;when u want to get all the records from one ITAB then want get the particular record of another ITAB then use LOOP in first ITAB then use read statement in second  ITAB with in the loop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jul 2008 09:14:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-and-loop/m-p/4194966#M1002711</guid>
      <dc:creator>Subhankar</dc:creator>
      <dc:date>2008-07-16T09:14:48Z</dc:date>
    </item>
  </channel>
</rss>

