<?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 with INDEX in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-with-index/m-p/2613754#M599776</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;Read table statement is used for Reading a particular internala table or a field it is used for selecting a single record. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE sets SY-TABIX to the index of the table line read. If you use a binary search, and the system does not find a line, SY-TABIX contains the total number of lines, or one more than the total number of lines. SY-INDEX is undefined if a linear search fails to return an entry.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this sample code &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;READ TABLE itab INTO wa WITH KEY field1 = X.
IF sy-subrc &amp;lt;&amp;gt; 0.
  READ TABLE itab INTO wa WITH KEY field2 = Y.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    READ TABLE itab INTO wa WITH KEY field3 = Z.
  ENDIF. 
ENDIF.
 
CHECK sy-subrc = 0. "Or an IF, of course

  &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward all helpfull answers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Pavan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 31 Jul 2007 06:40:05 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-07-31T06:40:05Z</dc:date>
    <item>
      <title>READ TABLE with INDEX</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-with-index/m-p/2613744#M599766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Friends,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please can u explain me what is the use of this READ statement, and why we use INDEX here.&lt;/P&gt;&lt;P&gt;READ TABLE z_tlines INDEX 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Shreekant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2007 06:33:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-with-index/m-p/2613744#M599766</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-31T06:33:17Z</dc:date>
    </item>
    <item>
      <title>Re: READ TABLE with INDEX</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-with-index/m-p/2613745#M599767</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;Read table with index 1 will read the first record from ur internal table.... index denotes the row of ur internal table....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;reward points if useful...&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;raksha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2007 06:33:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-with-index/m-p/2613745#M599767</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-31T06:33:42Z</dc:date>
    </item>
    <item>
      <title>Re: READ TABLE with INDEX</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-with-index/m-p/2613746#M599768</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;&amp;lt;u&amp;gt;READ TABLE z_tlines INDEX 1&amp;lt;/u&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It reads only one record...Either by index or key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE MY_TAB INDEX 1.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;READ TABLE MY_TAB WITH KEY CODE = 'ATG'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when we use the INDEX 1, it reads the 1st record of the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reading records with keys&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb35f8358411d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb35f8358411d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reading lines with Index&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb3730358411d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb3730358411d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds&lt;/P&gt;&lt;P&gt;Reshma&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2007 06:35:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-with-index/m-p/2613746#M599768</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-31T06:35:20Z</dc:date>
    </item>
    <item>
      <title>Re: READ TABLE with INDEX</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-with-index/m-p/2613747#M599769</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;If you need only the first record in the table you can use like this&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2007 06:35:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-with-index/m-p/2613747#M599769</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-31T06:35:42Z</dc:date>
    </item>
    <item>
      <title>Re: READ TABLE with INDEX</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-with-index/m-p/2613748#M599770</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;Read table is used when you want to read the contents of the internal table Z_tlines.&lt;/P&gt;&lt;P&gt;The option INDEX 1 is used to read the first line of the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Shruthi R&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2007 06:35:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-with-index/m-p/2613748#M599770</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-31T06:35:51Z</dc:date>
    </item>
    <item>
      <title>Re: READ TABLE with INDEX</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-with-index/m-p/2613749#M599771</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;READ TABLE isused to read from internal tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And INDEX can only be used with STANDARD and SORTED tables. INDEX can be used only with ORDERED and INDEXED tables like STADARD and SORTED tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is to read from certain position.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2007 06:37:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-with-index/m-p/2613749#M599771</guid>
      <dc:creator>seshatalpasai_madala</dc:creator>
      <dc:date>2007-07-31T06:37:01Z</dc:date>
    </item>
    <item>
      <title>Re: READ TABLE with INDEX</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-with-index/m-p/2613750#M599772</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;Read table will get the first record that saitisfies the condition specified in the with key statement into the header.&lt;/P&gt;&lt;P&gt;if an itab contains the following data:&lt;/P&gt;&lt;P&gt;field1 field2&lt;/P&gt;&lt;P&gt;1 one&lt;/P&gt;&lt;P&gt;2 two&lt;/P&gt;&lt;P&gt;3 three&lt;/P&gt;&lt;P&gt;4 four&lt;/P&gt;&lt;P&gt;5 five&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And if you read the itab like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table itab into WA with key field1 = '3'.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;write:/ wa.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;The output will be&lt;/P&gt;&lt;P&gt;3 three.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The sy-tabix will hold the value of index of the current record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;REWARDS POINT&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;ASHOK&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2007 06:37:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-with-index/m-p/2613750#M599772</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-31T06:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: READ TABLE with INDEX</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-with-index/m-p/2613751#M599773</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;If I want to read all the lines from the internal table what should I do.&lt;/P&gt;&lt;P&gt;Pls. reply me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Shreekant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2007 06:37:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-with-index/m-p/2613751#M599773</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-31T06:37:48Z</dc:date>
    </item>
    <item>
      <title>Re: READ TABLE with INDEX</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-with-index/m-p/2613752#M599774</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;If u want to read all the lines either u just use the same table for the purpose of usage or just loop at this table and put it onto a wrk area and use the record for further processing&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;reward points if useful&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2007 06:38:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-with-index/m-p/2613752#M599774</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-31T06:38:28Z</dc:date>
    </item>
    <item>
      <title>Re: READ TABLE with INDEX</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-with-index/m-p/2613753#M599775</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;read table st is used to read a record from internal table into workarea. with read statement we can do in 2 ways&lt;/P&gt;&lt;P&gt;       1. using index &lt;/P&gt;&lt;P&gt;       2. using key fields of the record&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for ex:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt; read table itab with index sy-tabix.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reads all records of internal table with respect to index. here index is also used to read particular record it its given outside loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;as similar usingkey field also we can read a record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if helpful reward some points.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with regards,&lt;/P&gt;&lt;P&gt;Suresh Aluri.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2007 06:40:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-with-index/m-p/2613753#M599775</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-31T06:40:03Z</dc:date>
    </item>
    <item>
      <title>Re: READ TABLE with INDEX</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-with-index/m-p/2613754#M599776</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;Read table statement is used for Reading a particular internala table or a field it is used for selecting a single record. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE sets SY-TABIX to the index of the table line read. If you use a binary search, and the system does not find a line, SY-TABIX contains the total number of lines, or one more than the total number of lines. SY-INDEX is undefined if a linear search fails to return an entry.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this sample code &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;READ TABLE itab INTO wa WITH KEY field1 = X.
IF sy-subrc &amp;lt;&amp;gt; 0.
  READ TABLE itab INTO wa WITH KEY field2 = Y.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    READ TABLE itab INTO wa WITH KEY field3 = Z.
  ENDIF. 
ENDIF.
 
CHECK sy-subrc = 0. "Or an IF, of course

  &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward all helpfull answers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Pavan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2007 06:40:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-with-index/m-p/2613754#M599776</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-31T06:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: READ TABLE with INDEX</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-with-index/m-p/2613755#M599777</link>
      <description>&lt;P&gt;Read table is used to read the record from your internal table "z_tlines" and if you mention the INDEX 1  with it then it means it will read the First record. &lt;/P&gt;</description>
      <pubDate>Tue, 31 Mar 2020 13:56:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-table-with-index/m-p/2613755#M599777</guid>
      <dc:creator>former_member668243</dc:creator>
      <dc:date>2020-03-31T13:56:55Z</dc:date>
    </item>
  </channel>
</rss>

