<?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 Table Vs Loop at in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-vs-loop-at/m-p/1599325#M269100</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;    Follow below steps.&lt;/P&gt;&lt;P&gt;    In se30 transaction you can look for &lt;/P&gt;&lt;P&gt;    Tip&amp;amp;TRicks button on application toolbar&lt;/P&gt;&lt;P&gt;    apart from below conventions&lt;/P&gt;&lt;P&gt;   Follow below steps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Remove corresponding from select satement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Remove * from select&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) Select field in sequence as defined in database&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4) Avoid unnecessary selects&lt;/P&gt;&lt;P&gt;i.e check for internal table not initial&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5) Use all entries and sort table by key fields&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;6) Remove selects ferom loop and use binary search&lt;/P&gt;&lt;P&gt;7) Try to use secondary index when you don't have &lt;/P&gt;&lt;P&gt;full key.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; Modify internal table use transporting option&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;9) Avoid nested loop . Use read table and loop at itab&lt;/P&gt;&lt;P&gt;from sy-tabix statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;10) free intrenal table memory wnen table is not &lt;/P&gt;&lt;P&gt;required for further processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;11)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Follow below logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM SUB_SELECTION_AUFKTAB.&lt;/P&gt;&lt;P&gt;if not it_plant[] is initial.&lt;/P&gt;&lt;P&gt;it_plant1[] = it_plant[].&lt;/P&gt;&lt;P&gt;sort it_plant1 by werks.&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from it_plant1 comparing werks &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT AUFNR KTEXT USER4 OBJNR INTO CORRESPONDING FIELDS OF TABLE I_AUFKTAB&lt;/P&gt;&lt;P&gt;FROM AUFK&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN it_plant1&lt;/P&gt;&lt;P&gt;WHERE AUFNR IN S_AUFNR AND&lt;/P&gt;&lt;P&gt;KTEXT IN S_KTEXT AND&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;WERKS IN S_WERKS AND&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;AUART IN S_AUART AND&lt;/P&gt;&lt;P&gt;USER4 IN S_USER4 AND&lt;/P&gt;&lt;P&gt;werks eq it_plant1-werks.&lt;/P&gt;&lt;P&gt;free it_plant1.&lt;/P&gt;&lt;P&gt;Endif.&lt;/P&gt;&lt;P&gt;ENDFORM. "SUB_SELECTION_AUFKTAB&lt;/P&gt;&lt;P&gt;&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;Amole&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 19 Sep 2006 09:36:28 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-09-19T09:36:28Z</dc:date>
    <item>
      <title>Read Table Vs Loop at</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-vs-loop-at/m-p/1599324#M269099</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know which one of the two should I use to improve the performance, for tables containing a lot of data ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in anticipation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alok.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Sep 2006 09:33:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-vs-loop-at/m-p/1599324#M269099</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-19T09:33:39Z</dc:date>
    </item>
    <item>
      <title>Re: Read Table Vs Loop at</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-vs-loop-at/m-p/1599325#M269100</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;    Follow below steps.&lt;/P&gt;&lt;P&gt;    In se30 transaction you can look for &lt;/P&gt;&lt;P&gt;    Tip&amp;amp;TRicks button on application toolbar&lt;/P&gt;&lt;P&gt;    apart from below conventions&lt;/P&gt;&lt;P&gt;   Follow below steps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Remove corresponding from select satement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Remove * from select&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) Select field in sequence as defined in database&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4) Avoid unnecessary selects&lt;/P&gt;&lt;P&gt;i.e check for internal table not initial&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5) Use all entries and sort table by key fields&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;6) Remove selects ferom loop and use binary search&lt;/P&gt;&lt;P&gt;7) Try to use secondary index when you don't have &lt;/P&gt;&lt;P&gt;full key.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; Modify internal table use transporting option&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;9) Avoid nested loop . Use read table and loop at itab&lt;/P&gt;&lt;P&gt;from sy-tabix statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;10) free intrenal table memory wnen table is not &lt;/P&gt;&lt;P&gt;required for further processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;11)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Follow below logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM SUB_SELECTION_AUFKTAB.&lt;/P&gt;&lt;P&gt;if not it_plant[] is initial.&lt;/P&gt;&lt;P&gt;it_plant1[] = it_plant[].&lt;/P&gt;&lt;P&gt;sort it_plant1 by werks.&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from it_plant1 comparing werks &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT AUFNR KTEXT USER4 OBJNR INTO CORRESPONDING FIELDS OF TABLE I_AUFKTAB&lt;/P&gt;&lt;P&gt;FROM AUFK&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN it_plant1&lt;/P&gt;&lt;P&gt;WHERE AUFNR IN S_AUFNR AND&lt;/P&gt;&lt;P&gt;KTEXT IN S_KTEXT AND&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;WERKS IN S_WERKS AND&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;AUART IN S_AUART AND&lt;/P&gt;&lt;P&gt;USER4 IN S_USER4 AND&lt;/P&gt;&lt;P&gt;werks eq it_plant1-werks.&lt;/P&gt;&lt;P&gt;free it_plant1.&lt;/P&gt;&lt;P&gt;Endif.&lt;/P&gt;&lt;P&gt;ENDFORM. "SUB_SELECTION_AUFKTAB&lt;/P&gt;&lt;P&gt;&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;Amole&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Sep 2006 09:36:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-vs-loop-at/m-p/1599325#M269100</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-19T09:36:28Z</dc:date>
    </item>
    <item>
      <title>Re: Read Table Vs Loop at</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-vs-loop-at/m-p/1599326#M269101</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;It depends on your requirement. What you wish to do...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lets assume you want to take a record from internal table and dosome processing on that..then, Read table stmnt with binary search is the best. (Sorting of the internal table is pre-requisite)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your task is to loop on all records, and do some calculations/summation etc..then looping on internal table is the only option.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Sep 2006 09:38:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-vs-loop-at/m-p/1599326#M269101</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-19T09:38:06Z</dc:date>
    </item>
    <item>
      <title>Re: Read Table Vs Loop at</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-vs-loop-at/m-p/1599327#M269102</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alok,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Both are different statements&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; READ statement is used inside a loop, READ statement will read only one record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to avoid loop inside a loop we use one loop and read the other internal table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Loop at ITAB.
  READ table ITAB2 with key field1 = itab-field1.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Sep 2006 09:40:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-vs-loop-at/m-p/1599327#M269102</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-19T09:40:23Z</dc:date>
    </item>
    <item>
      <title>Re: Read Table Vs Loop at</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-vs-loop-at/m-p/1599328#M269103</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;Case 1:&lt;/P&gt;&lt;P&gt;=======&lt;/P&gt;&lt;P&gt;If table has lot of data first of all loop at using field symbols,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB ASSIGNING &amp;lt;fs&amp;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;This would definitely improve the performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Case 1.1:&lt;/P&gt;&lt;P&gt;=========&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have single loop and dependsing up on the previous value you want to select data. Then first sort that internal table based on primary key and read the table using READ statement with BINARY SEARCH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT ITAB by f1.&lt;/P&gt;&lt;P&gt;READ TABLE ITAB INTO &amp;lt;WA&amp;gt; WITH KEY f1 = &amp;lt;Variable&amp;gt;&lt;/P&gt;&lt;P&gt;                          BINARY SEARCH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Case 3:&lt;/P&gt;&lt;P&gt;=======&lt;/P&gt;&lt;P&gt;Always ignore Loop inside loop. Instead go for READ if you have to play around 2 loops.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB1 INTO &amp;lt;WA&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   READ TABLE ITAB2 INTO &amp;lt;WA2&amp;gt; WITH KEY&lt;/P&gt;&lt;P&gt;     f1 = &amp;lt;WA&amp;gt;-f1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   if sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;   ENDIF.&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;Regs,&lt;/P&gt;&lt;P&gt;Venkat Ramanan N&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Sep 2006 09:42:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-vs-loop-at/m-p/1599328#M269103</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-19T09:42:59Z</dc:date>
    </item>
    <item>
      <title>Re: Read Table Vs Loop at</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-vs-loop-at/m-p/1599329#M269104</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if your intension to to read JUST only one record from the internal table,&lt;/P&gt;&lt;P&gt;you can use&lt;/P&gt;&lt;P&gt;READ TABLE ITAB WITH KEY F1 = &amp;lt;VALUE&amp;gt; ...&lt;/P&gt;&lt;P&gt;                       BINARY SEARDCH.&lt;/P&gt;&lt;P&gt;this statement can ONLY return 1 record. so if you know,only 1 record will be there for the given condition,you can use this statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;you must use LOOP AT and ENDLOOP statements to process more than 1 record.&lt;/P&gt;&lt;P&gt;LOOP AT ITAB WHERE F1 = &amp;lt;VALUE&amp;gt;.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Srikanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Sep 2006 09:43:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-vs-loop-at/m-p/1599329#M269104</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-19T09:43:58Z</dc:date>
    </item>
    <item>
      <title>Re: Read Table Vs Loop at</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-vs-loop-at/m-p/1599330#M269105</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi alok,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Good question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. I don't think there is any documentation avaialble&lt;/P&gt;&lt;P&gt;   for comparing LOOP v/s READ&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. But, practically, they make take almost,&lt;/P&gt;&lt;P&gt;  the same time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. just copy paste, for getting a taste of it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5.&lt;/P&gt;&lt;P&gt;REPORT ABC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : T1 TYPE SY-UZEIT.&lt;/P&gt;&lt;P&gt;DATA : T2 TYPE SY-UZEIT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : BEGIN OF ITAB OCCURS 0,&lt;/P&gt;&lt;P&gt;       F(50) TYPE c,&lt;/P&gt;&lt;P&gt;       END OF ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*-------&lt;/P&gt;&lt;P&gt;DO 900000 TIMES.&lt;/P&gt;&lt;P&gt;WRITE SY-INDEX TO ITAB-F.&lt;/P&gt;&lt;P&gt;CONDENSE ITAB-F.&lt;/P&gt;&lt;P&gt;CONCATENATE 'HELLO' ITAB-F INTO ITAB-F.&lt;/P&gt;&lt;P&gt;  APPEND ITAB.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----- LOOP&lt;/P&gt;&lt;P&gt;GET TIME.&lt;/P&gt;&lt;P&gt;T1 = SY-UZEIT.&lt;/P&gt;&lt;P&gt;loop at itab where f = 'HELLOXYZ'.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;GET TIME.&lt;/P&gt;&lt;P&gt;T2 = SY-UZEIT.&lt;/P&gt;&lt;P&gt;WRITE &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; 'FOR LOOP' , T1 , T2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----- READ&lt;/P&gt;&lt;P&gt;GET TIME.&lt;/P&gt;&lt;P&gt;T1 = SY-UZEIT.&lt;/P&gt;&lt;P&gt;READ TABLE ITAB WITH KEY F = 'HELLOXYZ1'.&lt;/P&gt;&lt;P&gt;GET TIME.&lt;/P&gt;&lt;P&gt;T2 = SY-UZEIT.&lt;/P&gt;&lt;P&gt;WRITE &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; 'FOR READ' , T1 , T2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&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;amit m.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Sep 2006 09:47:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-vs-loop-at/m-p/1599330#M269105</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-19T09:47:58Z</dc:date>
    </item>
    <item>
      <title>Re: Read Table Vs Loop at</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-vs-loop-at/m-p/1599331#M269106</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It complete depends on what you wish to do with the table data...lets say you have the main data in internal table itab and want to do some calculation for each record..you need to use LOOP AT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or if you are processing some other internal table and just need to fetch the corresponding record from itab..use should use READ TABLE ...it also advisable to sort the table internal table when you use READ on it and use BINARY SEARCH.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Sep 2006 09:48:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-vs-loop-at/m-p/1599331#M269106</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-19T09:48:37Z</dc:date>
    </item>
    <item>
      <title>Re: Read Table Vs Loop at</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-vs-loop-at/m-p/1599332#M269107</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alok&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It depends on they table key and the uniqueness of each row.  If you can define a unique key for your itab then Read is probably better because you can then specify the unique key in the REad statement.  If you are going to be repeatedly reading the table as opposed to just once then you might want to experiment with using a Sorted table type  with unique key or a Hashed table.  These table types have an overhead that will affect performance when they are modified or created but make reads much quicker (hashed table is constant irrespective of the number of records).  If you are not repeatedly reading the table then you might be better off using a standard table.  Again, if you can identify a unique key then you can sort the table before reading it and then use the BINARY SEARCH option of the Read statement, this will be much quicker than a full table scan.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With regard to using the LOOP AT statement, I believe it will only compete with the read statement if you are able to use a unique key with the WHERE otpion of the LOOP AT statement.  If the table has been sorted in advance then it should automatically use a binary search.  If you are not able to specify a unique key then the read statement will just return the first record it finds whereas the loop statement will obviously return the lot throughout the course of the loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortuantely, there is no short answer, you will have to try some run-time analysis to see which suits your needs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Sep 2006 09:54:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-vs-loop-at/m-p/1599332#M269107</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-19T09:54:07Z</dc:date>
    </item>
  </channel>
</rss>

