<?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 table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/hashed-table/m-p/3737656#M899558</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dhaya,&lt;/P&gt;&lt;P&gt;U have defined ur internal table with the user defined key&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;carrid connid&lt;/STRONG&gt;. This will exactly work as primary key of data base table. As u can't have more that one record in database table with same primary key here also u can't have 2 records having same value of the comabination of carrid connid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Modify ur definition like below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: sflight_wa1 LIKE HASHED TABLE OF sflight_wa&lt;/P&gt;&lt;P&gt;WITH NON-UNIQUE KEY carrid connid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vinod.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 25 Apr 2008 14:19:58 GMT</pubDate>
    <dc:creator>vinod_vemuru2</dc:creator>
    <dc:date>2008-04-25T14:19:58Z</dc:date>
    <item>
      <title>hashed table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/hashed-table/m-p/3737652#M899554</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; can  some one help me how to use hashed table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have tried with this code..but its giving runtime error  &lt;STRONG&gt;A row with the same key already exists&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF sflight_wa,&lt;/P&gt;&lt;P&gt;      carrid LIKE sflight-carrid,&lt;/P&gt;&lt;P&gt;      connid LIKE sflight-connid,&lt;/P&gt;&lt;P&gt;  END OF sflight_wa.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DATA: sflight_wa1 LIKE HASHED TABLE OF sflight_wa&lt;/P&gt;&lt;P&gt;         WITH UNIQUE KEY carrid connid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT carrid connid FROM sflight INTO TABLE sflight_wa1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    LOOP AT sflight_wa1 INTO sflight_wa.&lt;/P&gt;&lt;P&gt;WRITE: / sflight_wa-carrid.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanku.&lt;/P&gt;&lt;P&gt;dhaya.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Apr 2008 14:11:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/hashed-table/m-p/3737652#M899554</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-25T14:11:08Z</dc:date>
    </item>
    <item>
      <title>Re: hashed table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/hashed-table/m-p/3737653#M899555</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Selected value MUST be unique to add to the HASHED table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SELECT DISTINCT carrid connid FROM sflight INTO TABLE sflight_wa1.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Apr 2008 14:16:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/hashed-table/m-p/3737653#M899555</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-25T14:16:02Z</dc:date>
    </item>
    <item>
      <title>Re: hashed table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/hashed-table/m-p/3737654#M899556</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;It is giving error because the table &lt;STRONG&gt;SFLIGHT&lt;/STRONG&gt; contains Multiple Entries for Same combination of &lt;STRONG&gt;CARRID&lt;/STRONG&gt; and &lt;STRONG&gt;CONNID&lt;/STRONG&gt; and according to the definition of Internal Table the &lt;STRONG&gt;Carrid Connid&lt;/STRONG&gt; fields are &lt;STRONG&gt;UNIQUE&lt;/STRONG&gt;, hence an error is thrown&lt;/P&gt;&lt;P&gt;so use the below code to rectify the error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: BEGIN OF sflight_wa,
carrid LIKE sflight-carrid,
connid LIKE sflight-connid,
END OF sflight_wa.

DATA: sflight_wa1 LIKE HASHED TABLE OF sflight_wa
WITH UNIQUE KEY carrid connid.

SELECT DIstinct carrid connid FROM sflight INTO TABLE sflight_wa1.

LOOP AT sflight_wa1 INTO sflight_wa.
WRITE: / sflight_wa-carrid.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sunil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Apr 2008 14:17:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/hashed-table/m-p/3737654#M899556</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-25T14:17:30Z</dc:date>
    </item>
    <item>
      <title>Re: hashed table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/hashed-table/m-p/3737655#M899557</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The key of table SFLIGHT is CARRID CONNID and FLDATE hence it is possible to have multiple entries in that table with the same CARRID and CONNID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since you specified the unique key for your hashed table to be CARRID CONNID only you will get the error because you can't have the same key twice in your hashed table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Either do a select distinct or extend the primary key of your hashed table to include fldate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Apr 2008 14:17:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/hashed-table/m-p/3737655#M899557</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-25T14:17:59Z</dc:date>
    </item>
    <item>
      <title>Re: hashed table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/hashed-table/m-p/3737656#M899558</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dhaya,&lt;/P&gt;&lt;P&gt;U have defined ur internal table with the user defined key&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;carrid connid&lt;/STRONG&gt;. This will exactly work as primary key of data base table. As u can't have more that one record in database table with same primary key here also u can't have 2 records having same value of the comabination of carrid connid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Modify ur definition like below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: sflight_wa1 LIKE HASHED TABLE OF sflight_wa&lt;/P&gt;&lt;P&gt;WITH NON-UNIQUE KEY carrid connid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vinod.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Apr 2008 14:19:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/hashed-table/m-p/3737656#M899558</guid>
      <dc:creator>vinod_vemuru2</dc:creator>
      <dc:date>2008-04-25T14:19:58Z</dc:date>
    </item>
    <item>
      <title>Re: hashed table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/hashed-table/m-p/3737657#M899559</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't believe you can use NON-UNIQUE KEY in a hashed table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is from SAP Doc&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;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;Defines the table as one that is managed with an internal hash procedure. You can imagine a hashed table as a set, whose elements&lt;/P&gt;&lt;P&gt;you can address using their unique key. Unlike standard and sorted tables, you cannot access hash tables using an index. &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;All entries in the table must have a unique key.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt; Access time using the key is constant, regardless of the number of table entries. &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&lt;/P&gt;&lt;P&gt;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, 25 Apr 2008 14:24:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/hashed-table/m-p/3737657#M899559</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-25T14:24:17Z</dc:date>
    </item>
    <item>
      <title>Re: hashed table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/hashed-table/m-p/3737658#M899560</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanku for ur replies...now my probled has solved..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Apr 2008 14:32:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/hashed-table/m-p/3737658#M899560</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-25T14:32:57Z</dc:date>
    </item>
  </channel>
</rss>

