<?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: internal tables in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/2397507#M533788</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Prashanth,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have to use the Read Statement on the Internal tables only. You should not use directly READ statement on the database tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should go FOR ALL ENTRIES statement when u select statements on the Database tables. This is basically used for the Performance on the Select queries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward Points if the message is useful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Hari krishna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 18 Jun 2007 09:28:36 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-06-18T09:28:36Z</dc:date>
    <item>
      <title>internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/2397502#M533783</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;when should we use read table or when should we use for all entries&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; points for sure&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jun 2007 09:12:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/2397502#M533783</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-18T09:12:21Z</dc:date>
    </item>
    <item>
      <title>Re: internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/2397503#M533784</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 table ITAb...is used to read a single entry of that internal table under the loop of some other internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For all entries is used to fetch the records from a database table with reference to the for all entries of an internal table&lt;/P&gt;&lt;P&gt;The WHERE clause of the SELECT statement has a special variant that allows you to derive conditions from the lines and columns of an internal table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT ... FOR ALL ENTRIES IN &amp;lt;itab&amp;gt; WHERE &amp;lt;cond&amp;gt; ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;cond&amp;gt; may be formulated as described above. If you specify a field of the internal table &amp;lt;itab&amp;gt; as an operand in a condition, you address all lines of the internal table. The comparison is then performed for each line of the internal table. For each line, the system selects the lines from the database table that satisfy the condition. The result set of the SELECT statement is the union of the individual selections for each line of the internal table. Duplicate lines are automatically eliminated from the result set. If &amp;lt;itab&amp;gt; is empty, the addition FOR ALL ENTRIES is disregarded, and all entries are read. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The internal table &amp;lt;itab&amp;gt; must have a structured line type, and each field that occurs in the condition &amp;lt;cond&amp;gt; must be compatible with the column of the database with which it is compared. Do not use the operators LIKE, BETWEEN, and IN in comparisons using internal table fields. You may not use the ORDER BY clause in the same SELECT statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use the option FOR ALL ENTRIES to replace nested select loops by operations on internal tables. This can significantly improve the performance for large sets of selected data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points for useful Answers&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jun 2007 09:14:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/2397503#M533784</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-18T09:14:28Z</dc:date>
    </item>
    <item>
      <title>Re: internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/2397504#M533785</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We use Read Table, when its is need to read the single record from the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We use For all entries, when we want to read the records from the database table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jun 2007 09:15:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/2397504#M533785</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-18T09:15:01Z</dc:date>
    </item>
    <item>
      <title>Re: internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/2397505#M533786</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 to read a single row from the internal table specifying some condition.&lt;/P&gt;&lt;P&gt;e.g. READ TABLE ITAB INDEX 2. &lt;/P&gt;&lt;P&gt;or READ TABLE ITAB WITH KEY MATNR = mat1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will get a single row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, for all entries is generally used as an alternative of join.&lt;/P&gt;&lt;P&gt;e.g. U want some values from Database table DB1 based upon the values in ITAB1.&lt;/P&gt;&lt;P&gt;Then u write :&lt;/P&gt;&lt;P&gt;SELECT col1 col2 into corresponding fields of table ITAB2 from DB1 for all entries in ITAB1 where DB1-col1 = ITAB1-col1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hence READ statement is used to read data from internal tables.&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES is used to get data from database based on the values in another internal table&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Himanshu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jun 2007 09:16:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/2397505#M533786</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-18T09:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/2397506#M533787</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;&amp;lt;b&amp;gt;For All Entries:&amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The WHERE clause of the SELECT statement has a special variant that allows you to derive&lt;/P&gt;&lt;P&gt;conditions from the lines and columns of an internal table:&lt;/P&gt;&lt;P&gt;SELECT ... FOR ALL ENTRIES IN &amp;lt;itab&amp;gt; WHERE &amp;lt;cond&amp;gt; ...&lt;/P&gt;&lt;P&gt;&amp;lt;cond&amp;gt; may be formulated as described above. If you specify a field of the internal table &amp;lt;itab&amp;gt;&lt;/P&gt;&lt;P&gt;as an operand in a condition, you address all lines of the internal table. The comparison is then&lt;/P&gt;&lt;P&gt;performed for each line of the internal table. For each line, the system selects the lines from the&lt;/P&gt;&lt;P&gt;database table that satisfy the condition. The result set of the SELECT statement is the union of&lt;/P&gt;&lt;P&gt;the individual selections for each line of the internal table. Duplicate lines are automatically&lt;/P&gt;&lt;P&gt;eliminated from the result set. If &amp;lt;itab&amp;gt; is empty, the addition FOR ALL ENTRIES is disregarded,&lt;/P&gt;&lt;P&gt;and all entries are read.&lt;/P&gt;&lt;P&gt;The internal table &amp;lt;itab&amp;gt; must have a structured line type, and each field that occurs in the&lt;/P&gt;&lt;P&gt;condition &amp;lt;cond&amp;gt; must be compatible with the column of the database with which it is compared.&lt;/P&gt;&lt;P&gt;Do not use the operators LIKE, BETWEEN, and IN in comparisons using internal table fields.&lt;/P&gt;&lt;P&gt;You may not use the ORDER BY clause in the same SELECT statement.&lt;/P&gt;&lt;P&gt;You can use the option FOR ALL ENTRIES to replace nested select loops by operations on&lt;/P&gt;&lt;P&gt;internal tables. This can significantly improve the performance for large sets of selected data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;Read Table:&amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To read a single line of any table, use the statement:&lt;/P&gt;&lt;P&gt;READ TABLE &amp;lt;itab&amp;gt; &amp;lt;key&amp;gt; &amp;lt;result&amp;gt;.&lt;/P&gt;&lt;P&gt;For the statement to be valid for any kind of table, you must specify the entry using the key and&lt;/P&gt;&lt;P&gt;not the index. You specify the key in the &amp;lt;key&amp;gt; part of the statement. The &amp;lt;result&amp;gt; part can&lt;/P&gt;&lt;P&gt;specify a further processing option for the line that is retrieved.&lt;/P&gt;&lt;P&gt;If the system finds an entry, it sets SY-SUBRC to zero, if not, it takes the value 4, as long as it is&lt;/P&gt;&lt;P&gt;not influenced by one of the possible additions. If the internal table is an index table, SY-TABIX&lt;/P&gt;&lt;P&gt;is set to the index of the line retrieved. If the table has a non-unique key and there are duplicate&lt;/P&gt;&lt;P&gt;entries, the first entry is read.&lt;/P&gt;&lt;P&gt;Specifying the Search Key&lt;/P&gt;&lt;P&gt;The search key may be either the table key or another key.&lt;/P&gt;&lt;P&gt;Using the Table Key&lt;/P&gt;&lt;P&gt;To use the table key of &amp;lt;itab&amp;gt; as a search key, enter &amp;lt;key&amp;gt; as follows:&lt;/P&gt;&lt;P&gt;READ TABLE &amp;lt;itab&amp;gt; FROM &amp;lt;wa&amp;gt; &amp;lt;result&amp;gt;.&lt;/P&gt;&lt;P&gt;or as follows&lt;/P&gt;&lt;P&gt;READ TABLE &amp;lt;itab&amp;gt; WITH TABLE KEY &amp;lt;k1&amp;gt; = &amp;lt;f1&amp;gt; ... &amp;lt;kn&amp;gt; = &amp;lt;fn&amp;gt; &amp;lt;result&amp;gt;.&lt;/P&gt;&lt;P&gt;In the first case, &amp;lt;wa&amp;gt; must be a work area compatible with the line type of &amp;lt;itab&amp;gt;. The values&lt;/P&gt;&lt;P&gt;of the key fields are taken from the corresponding components of the work area.&lt;/P&gt;&lt;P&gt;In the second case, you have to supply the values of each key field explicitly. If you do not know&lt;/P&gt;&lt;P&gt;the name of one of the key fields until runtime, you can specify it as the content of a field &amp;lt;ni&amp;gt;&lt;/P&gt;&lt;P&gt;using the form (&amp;lt;ni&amp;gt;) = &amp;lt;fi&amp;gt;. If the data types of &amp;lt;fi&amp;gt; are not compatible with the key fields, the&lt;/P&gt;&lt;P&gt;system converts them.&lt;/P&gt;&lt;P&gt;The system searches for the relevant lines as follows:&lt;/P&gt;&lt;P&gt;  Standard tables&lt;/P&gt;&lt;P&gt;Linear search, where the runtime is in linear relation to the number of table entries.&lt;/P&gt;&lt;P&gt;  Sorted tables&lt;/P&gt;&lt;P&gt;Binary search, where the runtime is in logarithmic relation to the number of table entries.&lt;/P&gt;&lt;P&gt;  Hashed tables&lt;/P&gt;&lt;P&gt;The entry is found using the hash algorithm of the internal table. The runtime is&lt;/P&gt;&lt;P&gt;independent of the number of table entries.&lt;/P&gt;&lt;P&gt;Using a Different Search Key&lt;/P&gt;&lt;P&gt;To use a key other than the table key as a search key, enter &amp;lt;key&amp;gt; as follows:&lt;/P&gt;&lt;P&gt;READ TABLE &amp;lt;itab&amp;gt; WITH KEY = &amp;lt;f&amp;gt; &amp;lt;result&amp;gt;.&lt;/P&gt;&lt;P&gt;or as follows&lt;/P&gt;&lt;P&gt;READ TABLE &amp;lt;itab&amp;gt; WITH KEY &amp;lt;k1&amp;gt; = &amp;lt;f1&amp;gt; ... &amp;lt;kn&amp;gt; = &amp;lt;fn&amp;gt; &amp;lt;result&amp;gt;.&lt;/P&gt;&lt;P&gt;In the first case, the whole line of the internal table is used as the search key. The contents of&lt;/P&gt;&lt;P&gt;the entire table line are compared with the contents of field &amp;lt;f&amp;gt;. If &amp;lt;f&amp;gt; is not compatible with the&lt;/P&gt;&lt;P&gt;line type of the table, the value is converted into the line type. The search key allows you to find&lt;/P&gt;&lt;P&gt;entries in internal tables that do not have a structured line type, that is, where the line is a single&lt;/P&gt;&lt;P&gt;field or an internal table type.&lt;/P&gt;&lt;P&gt;In the second case, the search key can consist of any of the table fields &amp;lt;k1&amp;gt;...&amp;lt;kn&amp;gt;. If you do not&lt;/P&gt;&lt;P&gt;know the name of one of the components until runtime, you can specify it as the content of a field&lt;/P&gt;&lt;P&gt;&amp;lt;ni&amp;gt; using the form (&amp;lt;ni&amp;gt;) = &amp;lt;fi&amp;gt;. If &amp;lt;ni&amp;gt; is empty when the statement is executed, the search&lt;/P&gt;&lt;P&gt;field is ignored. If the data types of &amp;lt;fi&amp;gt; are not compatible with the components in the internal&lt;/P&gt;&lt;P&gt;table, the system converts them. You can restrict the search to partial fields [Page 196] by&lt;/P&gt;&lt;P&gt;specifying offset and length.&lt;/P&gt;&lt;P&gt;The search is linear for all table types. The runtime is in linear relation to the number of table&lt;/P&gt;&lt;P&gt;lines.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Bhaskar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jun 2007 09:24:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/2397506#M533787</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-18T09:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/2397507#M533788</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Prashanth,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have to use the Read Statement on the Internal tables only. You should not use directly READ statement on the database tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should go FOR ALL ENTRIES statement when u select statements on the Database tables. This is basically used for the Performance on the Select queries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward Points if the message is useful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Hari krishna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jun 2007 09:28:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/2397507#M533788</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-18T09:28:36Z</dc:date>
    </item>
  </channel>
</rss>

