<?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 help regarding key in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-regarding-key/m-p/1889534#M372691</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;/P&gt;&lt;P&gt;what is the difference between &lt;/P&gt;&lt;P&gt;READ TABLE &amp;lt;INTERNAL-TABLE&amp;gt; WITH TABLE KEY.    &amp;amp;&lt;/P&gt;&lt;P&gt;READ TABLE &amp;lt;INTERNAL-TABLE&amp;gt; WITH  KEY .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 23 Jan 2007 18:11:21 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-01-23T18:11:21Z</dc:date>
    <item>
      <title>help regarding key</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-regarding-key/m-p/1889534#M372691</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;/P&gt;&lt;P&gt;what is the difference between &lt;/P&gt;&lt;P&gt;READ TABLE &amp;lt;INTERNAL-TABLE&amp;gt; WITH TABLE KEY.    &amp;amp;&lt;/P&gt;&lt;P&gt;READ TABLE &amp;lt;INTERNAL-TABLE&amp;gt; WITH  KEY .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jan 2007 18:11:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-regarding-key/m-p/1889534#M372691</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-23T18:11:21Z</dc:date>
    </item>
    <item>
      <title>Re: help regarding key</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-regarding-key/m-p/1889535#M372692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;welcome 2 sdn.&lt;/P&gt;&lt;P&gt;If u use WITH TABLE KEY addition then you need to specify all the key fields of your table.&lt;/P&gt;&lt;P&gt;If u use WITH KEY then you can skip some of the key fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Abdul Hakim&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark all useful answers..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jan 2007 18:30:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-regarding-key/m-p/1889535#M372692</guid>
      <dc:creator>abdul_hakim</dc:creator>
      <dc:date>2007-01-23T18:30:22Z</dc:date>
    </item>
    <item>
      <title>Re: help regarding key</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-regarding-key/m-p/1889536#M372693</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;To read a single line of any table, use the statement: &lt;/P&gt;&lt;P&gt;&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;&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 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 specify a further processing option for the line that is retrieved. &lt;/P&gt;&lt;P&gt;&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 not influenced by one of the possible additions. If the internal table is an index table, SY-TABIX is set to the index of the line retrieved. If the table has a non-unique key and there are duplicate entries, the first entry is read. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Specifying the Search Key&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The search key may be either the table key or another key. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using the Table Key&lt;/P&gt;&lt;P&gt;&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;&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;&lt;/P&gt;&lt;P&gt;or as follows&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE &amp;lt;itab&amp;gt; WITH TABLE KEY &amp;lt;k1&amp;gt; = &amp;lt;f 1&amp;gt; ... &amp;lt;k n&amp;gt; = &amp;lt;f n&amp;gt; &amp;lt;result&amp;gt;.&lt;/P&gt;&lt;P&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 of the key fields are taken from the corresponding components of the work area. &lt;/P&gt;&lt;P&gt;&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 the name of one of the key fields until runtime, you can specify it as the content of a field &amp;lt;n i &amp;gt; using the form (&amp;lt;n i &amp;gt;) = &amp;lt;f i &amp;gt;. If the data types of &amp;lt;f i &amp;gt; are not compatible with the key fields, the system converts them. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The system searches for the relevant lines as follows: &lt;/P&gt;&lt;P&gt;&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;&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;&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 independent of the number of table entries. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using a Different Search Key&lt;/P&gt;&lt;P&gt;&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;&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;&lt;/P&gt;&lt;P&gt;or as follows&lt;/P&gt;&lt;P&gt;&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;k n&amp;gt; = &amp;lt;f n&amp;gt; &amp;lt;result&amp;gt;.&lt;/P&gt;&lt;P&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 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 line type of the table, the value is converted into the line type. The search key allows you to find entries in internal tables that do not have a structured line type, that is, where the line is a single field or an internal table type. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the second case, the search key can consist of any of the table fields &amp;lt;k 1 &amp;gt;...&amp;lt;k n &amp;gt;. If you do not know the name of one of the components until runtime, you can specify it as the content of a field &amp;lt;n i &amp;gt; using the form (&amp;lt;n i &amp;gt;) = &amp;lt;f i &amp;gt;. If &amp;lt;n i &amp;gt; is empty when the statement is executed, the search field is ignored. If the data types of &amp;lt;f i &amp;gt; are not compatible with the components in the internal table, the system converts them. You can restrict the search to partial fields by specifying offset and length. &lt;/P&gt;&lt;P&gt;&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 lines.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vara&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jan 2007 18:36:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-regarding-key/m-p/1889536#M372693</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-23T18:36:06Z</dc:date>
    </item>
  </channel>
</rss>

