<?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 background in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-background/m-p/10714163#M1872443</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Close. It's ABAP pixies.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 Nov 2014 07:22:57 GMT</pubDate>
    <dc:creator>matt</dc:creator>
    <dc:date>2014-11-06T07:22:57Z</dc:date>
    <item>
      <title>Internal tables background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-background/m-p/10714152#M1872432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Experts,&lt;/P&gt;&lt;P&gt;i have been going through many threads but no answer found.&lt;/P&gt;&lt;P&gt;Assume i define internal table as for instance DATA itab TYPE SORTED TABLE OF dtab WITH NON-UNIQUE KEY field_a.&lt;/P&gt;&lt;P&gt;1. If the database table is activated, then for primary keys the index table is created in database. But what happens with the internal table above? Is there a similar background process? Also the hashed table.&lt;/P&gt;&lt;P&gt;2. Assume i want to LOOP itab INTO wa WHERE field_b = 'aaa'. How is in this case table scanned? Is there a full table scan applied? The same with READ statement with addition WITH KEY field_b.&lt;/P&gt;&lt;P&gt;3. Also i dont understand the definition that for "structured line type only not numerical fields are included in defauld key". But i can use WHERE statement for fields that are not included in default key. I know there are 2 ways how to access internal table, index and key access.&lt;/P&gt;&lt;P&gt;But base on my experiences every field in table can be accessed, regardless i have explicitly defined it or not. How is this handled by runtime?&lt;/P&gt;&lt;P&gt;I would appreciate your help, but please avoid using the guide definitions.&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Nov 2014 13:20:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-background/m-p/10714152#M1872432</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-11-04T13:20:34Z</dc:date>
    </item>
    <item>
      <title>Re: Internal tables background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-background/m-p/10714153#M1872433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Regarding your questions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Noting happens to the internal table above when the underlying transparent table is activated. The primary key index of the internal table is build up at runtime when you insert lines into the internal table. (At runtime, the current activated definition of the transparent table is used.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. If you perform a LOOP with a WHERE condition and the condition is a field not contained in the primary key of the internal table, a full table scan is performed. The same hold for a READ TABLE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Yes, you can use any field of the table definition for a WHERE condition (for standard and sorted tables; for hashed tables you have to use the exact key). In case you use fields not contained in the primary key (or a secondary key) the system may perform a full table scan (because no suitable index is available to speed up access).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope that helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Valentin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Nov 2014 14:18:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-background/m-p/10714153#M1872433</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-11-04T14:18:54Z</dc:date>
    </item>
    <item>
      <title>Re: Internal tables background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-background/m-p/10714154#M1872434</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Valentin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regarding the 1. question. To be 100% sure, lets assume my internal table has 5 fields. So when i define internal table as for instance DATA itab TYPE SORTED TABLE OF dtab WITH NON-UNIQUE KEY field_a, then index table, something like this is created in runtime?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="252"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" width="150"&gt;field_a&lt;/TD&gt;&lt;TD class="xl64" style="border-left: medium none;" width="102"&gt;Index&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: medium none;"&gt;a&lt;/TD&gt;&lt;TD align="right" class="xl64" style="border-left: medium none; border-top: medium none;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: medium none;"&gt;b&lt;/TD&gt;&lt;TD align="right" class="xl64" style="border-left: medium none; border-top: medium none;"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: medium none;"&gt;…&lt;/TD&gt;&lt;TD class="xl64" style="border-left: medium none; border-top: medium none;"&gt;…&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, the rest questions were answered clearly.&lt;/P&gt;&lt;P&gt;Jan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Nov 2014 14:29:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-background/m-p/10714154#M1872434</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-11-04T14:29:58Z</dc:date>
    </item>
    <item>
      <title>Re: Internal tables background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-background/m-p/10714155#M1872435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorted tables have an internal index so yes in main memory there would be a similar table available during the program runtime.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Nov 2014 16:35:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-background/m-p/10714155#M1872435</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-11-04T16:35:36Z</dc:date>
    </item>
    <item>
      <title>Re: Internal tables background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-background/m-p/10714156#M1872436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Jan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure what you refer to when you say "&lt;SPAN style="text-decoration: underline;"&gt;then&lt;/SPAN&gt; index table." Every sorted table is per definition also an index table (like any standard table). Anyhow, with the definition of the sorted table with non-unique key some kind of non-visible table is created by the ABAP run-time system - as you wrote - with two columns "field_a" and "start_index". When entries are inserted into the table the table is built up. After inserting&lt;/P&gt;&lt;P&gt;Entries&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;field_a = "a", ...&lt;/P&gt;&lt;P&gt;field_a = "b", ...&lt;/P&gt;&lt;P&gt;field_a = "a", ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the table contents look like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;field_a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; start_index&lt;/P&gt;&lt;P&gt;a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;b&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Valentin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Nov 2014 06:48:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-background/m-p/10714156#M1872436</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-11-05T06:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: Internal tables background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-background/m-p/10714157#M1872437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Valentin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i was refering to Index, meaning when you create database table then copy of this table having few number of fields (Primary keys) is created (Index table).&lt;/P&gt;&lt;P&gt;My last question, assume i create two tables with 5 fields:&lt;/P&gt;&lt;P&gt;1. DATA itab TYPE STANDARD TABLE OF dtab, then i sort this table with field_c. Perform binary search with key access field_c.&lt;/P&gt;&lt;P&gt;2. DATA itab TYPE SORTED TABLE OF dtab WITH NON-UNIQUE KEY field_c. Here i perform too search with key access field_c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which search is faster?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;Jan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Nov 2014 07:53:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-background/m-p/10714157#M1872437</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-11-05T07:53:42Z</dc:date>
    </item>
    <item>
      <title>Re: Internal tables background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-background/m-p/10714158#M1872438</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My gut feeling says that building up the standard table contents is faster (because the system just has to append entries) than buiding up the sorted table (because the system may re-sort existing entries during the insert process), sorting the standard table kind of compensates for this and the speed of the key access (e.g. with a READ TABLE statement) is the same for both table types.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My brains says that the only way to find out any difference is by building a complete example and doing a performance measurement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Valentin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Nov 2014 08:11:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-background/m-p/10714158#M1872438</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-11-05T08:11:06Z</dc:date>
    </item>
    <item>
      <title>Re: Internal tables background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-background/m-p/10714159#M1872439</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes you're right , it is, fetching same set of records from db to itab and measuring runtimes, I found out sorted table takes slightly more time, but its very minimal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can measure this by writing a very small piece code and measuring run times using get runtime field.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Nov 2014 16:46:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-background/m-p/10714159#M1872439</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-11-05T16:46:43Z</dc:date>
    </item>
    <item>
      <title>Re: Internal tables background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-background/m-p/10714160#M1872440</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In most cases, maintainability and stability are more important than speed. Making a program run faster doesn't usually impact a company's profits. Having a program that is hard to maintain, or fails often, is costly, and so does impact the profits.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As a matter of design, you should use the table type appropriate for your application. If you're looking up data by unique key, then that should be a HASHED table. If you need data to be sorted, then a SORTED table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The area I work in typically deals with millions of records. For me, performance and memory consumption are things I really have to take into consideration. Funnily enough, when I have to optimise a program, I've achieved great gains by switching STANDARD table to HASHED or SORTED. I've never had to switch &lt;EM&gt;back&lt;/EM&gt; to a STANDARD table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Nov 2014 18:46:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-background/m-p/10714160#M1872440</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2014-11-05T18:46:04Z</dc:date>
    </item>
    <item>
      <title>Re: Internal tables background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-background/m-p/10714161#M1872441</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jan, I suspect you might be just confused by READ... WITH KEY. Here "key" is not the "key" in the same sense as in the database tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the ABAP Editor there are examples available including the performance ones. It's all there, so check it out. Also we can use Runtime Analysis to track the performance and test any theory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;+1 to what Matthew said. I've never really wondered how exactly hashed or sorted tables work "behind the scenes" (there could be some ABAP gnomes for all I care), but these basic rules of which table type is best for what are a must-know.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Nov 2014 22:48:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-background/m-p/10714161#M1872441</guid>
      <dc:creator>Jelena_Perfiljeva</dc:creator>
      <dc:date>2014-11-05T22:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: Internal tables background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-background/m-p/10714162#M1872442</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you all for your answers, i appreciate it.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Nov 2014 07:13:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-background/m-p/10714162#M1872442</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-11-06T07:13:55Z</dc:date>
    </item>
    <item>
      <title>Re: Internal tables background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-background/m-p/10714163#M1872443</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Close. It's ABAP pixies.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Nov 2014 07:22:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables-background/m-p/10714163#M1872443</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2014-11-06T07:22:57Z</dc:date>
    </item>
  </channel>
</rss>

