<?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: hashed &amp; sorted internal tables in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/hashed-sorted-internal-tables/m-p/1779776#M336116</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;SORTED table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Defines the table as one that is always saved correctly sorted. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Key access to a sorted table uses a binary key. If the key is not unique, the system takes the entry with the lowest index. The runtime required for key access is logarithmically related to the number of table entries. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HASHED table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Defines the table as one that is managed with an internal hash procedure&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can only access a hashed table using the generic key operations or other generic operations ( SORT, LOOP, and so on). Explicit or implicit index operations (such as LOOP ... FROM oe INSERT itab within a LOOP) are not allowed.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 22 Dec 2006 09:14:19 GMT</pubDate>
    <dc:creator>jayanthi_jayaraman</dc:creator>
    <dc:date>2006-12-22T09:14:19Z</dc:date>
    <item>
      <title>hashed &amp; sorted internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/hashed-sorted-internal-tables/m-p/1779774#M336114</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi all,&lt;/P&gt;&lt;P&gt;    can any body help me to understand the concept of &amp;lt;b&amp;gt;hashed &amp;amp; sorted&amp;lt;/b&amp;gt; internal table  &amp;amp; how they can be used for improve the performance of report.&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;Deepak&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Dec 2006 09:10:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/hashed-sorted-internal-tables/m-p/1779774#M336114</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-22T09:10:30Z</dc:date>
    </item>
    <item>
      <title>Re: hashed &amp; sorted internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/hashed-sorted-internal-tables/m-p/1779775#M336115</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can see this link&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/people/harry.dietz/blog/2005/10/28/performance-improvement-hints-3-internal-table--fill-and-read&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/what-are-different-types-of-internal-tables-and-their-usage.htm" target="test_blank"&gt;http://www.sap-img.com/abap/what-are-different-types-of-internal-tables-and-their-usage.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;kishan negi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Dec 2006 09:13:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/hashed-sorted-internal-tables/m-p/1779775#M336115</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-22T09:13:39Z</dc:date>
    </item>
    <item>
      <title>Re: hashed &amp; sorted internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/hashed-sorted-internal-tables/m-p/1779776#M336116</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;SORTED table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Defines the table as one that is always saved correctly sorted. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Key access to a sorted table uses a binary key. If the key is not unique, the system takes the entry with the lowest index. The runtime required for key access is logarithmically related to the number of table entries. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HASHED table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Defines the table as one that is managed with an internal hash procedure&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can only access a hashed table using the generic key operations or other generic operations ( SORT, LOOP, and so on). Explicit or implicit index operations (such as LOOP ... FROM oe INSERT itab within a LOOP) are not allowed.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Dec 2006 09:14:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/hashed-sorted-internal-tables/m-p/1779776#M336116</guid>
      <dc:creator>jayanthi_jayaraman</dc:creator>
      <dc:date>2006-12-22T09:14:19Z</dc:date>
    </item>
    <item>
      <title>Re: hashed &amp; sorted internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/hashed-sorted-internal-tables/m-p/1779777#M336117</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;Check this out&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT zforum34  LINE-SIZE 255.
 
PARAMETERS p_ktopl LIKE t001-ktopl.
PARAMETERS p_bukrs LIKE t001-bukrs.
PARAMETERS p_konto LIKE skb1-saknr.
 
DATA: t1   TYPE i,
      t2   TYPE i,
      tmin TYPE i.
 
DATA stab TYPE SORTED TABLE OF skb1 WITH UNIQUE KEY bukrs  saknr.
DATA htab TYPE HASHED TABLE OF skb1 WITH UNIQUE KEY bukrs  saknr.
DATA wa TYPE skb1.
 
SELECT        * FROM  skb1 INTO TABLE stab.
write: /'cnt:', sy-dbcnt.
uline.
htab = stab.
 
 
GET RUN TIME FIELD t1.
READ TABLE stab INTO wa WITH TABLE KEY bukrs = p_bukrs
                                       saknr = p_konto.
 
GET RUN TIME FIELD t2.
tmin = t2 - t1.
WRITE:/  'sorted table :', tmin, 'microseconds'.
 
ULINE.
CLEAR: t1, t2, tmin.
FREE stab.
GET RUN TIME FIELD t1.
READ TABLE htab INTO wa WITH TABLE KEY bukrs = p_bukrs
                                       saknr = p_konto.
 
GET RUN TIME FIELD t2.
tmin = t2 - t1.
WRITE:/  'hashed table :', tmin, 'microseconds'.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Dec 2006 10:03:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/hashed-sorted-internal-tables/m-p/1779777#M336117</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-22T10:03:29Z</dc:date>
    </item>
    <item>
      <title>Re: hashed &amp; sorted internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/hashed-sorted-internal-tables/m-p/1779778#M336118</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check...&lt;/P&gt;&lt;P&gt;/people/harry.dietz/blog/2005/10/28/performance-improvement-hints-3-internal-table--fill-and-read&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Dec 2006 10:12:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/hashed-sorted-internal-tables/m-p/1779778#M336118</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-22T10:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: hashed &amp; sorted internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/hashed-sorted-internal-tables/m-p/1779779#M336119</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Deepak,&lt;/P&gt;&lt;P&gt;If you have an internal table in your program which is used solely for lookup, it is good programming practice to use a hash table. The example below shows this, in combination with a method for buffering SELECT SINGLE results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  select_dispo&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Get MRP controller and in-house production time from material &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      and plant&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     --&amp;gt; MATNR  Material&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     --&amp;gt; RESWK  Plant&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     &amp;lt;-- DISPO  MRP controller&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     &amp;lt;-- DZEIT  In-house production time&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form select_from_marc using matnr werks dispo dzeit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  types: begin of mrp_lookup_type,&lt;/P&gt;&lt;P&gt;           matnr like marc-matnr,&lt;/P&gt;&lt;P&gt;           werks like marc-werks,&lt;/P&gt;&lt;P&gt;           dispo like marc-dispo,&lt;/P&gt;&lt;P&gt;           dzeit like marc-dzeit,&lt;/P&gt;&lt;P&gt;         end of mrp_lookup_type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Define static hashed table to hold results&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  statics: st_mrp type hashed table of mrp_lookup_type&lt;/P&gt;&lt;P&gt;                  with unique key matnr werks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  data: l_wa_mrp type mrp_lookup_type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  clear dzeit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;See if data is in the table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  read table st_mrp into l_wa_mrp with table key matnr = matnr&lt;/P&gt;&lt;P&gt;                                                 werks = werks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;If not in table, get it from the database&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  if not sy-subrc is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    select single dispo dzeit from marc&lt;/P&gt;&lt;P&gt;        into corresponding fields of l_wa_mrp-dispo&lt;/P&gt;&lt;P&gt;        where matnr eq matnr&lt;/P&gt;&lt;P&gt;          and werks eq werks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Insert into table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    l_wa_mrp-matnr = matnr.&lt;/P&gt;&lt;P&gt;    l_wa_mrp-werks = werks.&lt;/P&gt;&lt;P&gt;    insert l_wa_mrp into table st_mrp.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  dispo = l_wa_mrp-dispo.                      " MRP Controller&lt;/P&gt;&lt;P&gt;  dzeit = l_wa_mrp-dzeit.                      " Inhouse production time&lt;/P&gt;&lt;P&gt;endform.                    " select_from_marc&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Dec 2006 10:48:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/hashed-sorted-internal-tables/m-p/1779779#M336119</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-22T10:48:18Z</dc:date>
    </item>
  </channel>
</rss>

