Skip to Content
avatar image
Former Member

hashed table


Is there any requirment to use hashed internal table ?

how to implement that?



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Nov 16, 2006 at 04:27 AM


    Hashed table have the fastest access. Since you can access them only using the KEY access.

    You need to use HASHED TABLE when you have lot of DATA table and want to read from that table based on UNIQUE key. You will get the best performance in this case.

    Hashed tables cannot have duplicate entries.

    The key values are always unique


    DATA: it_tab type hased table of spfli with unique key carrid connid fldate.



    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 16, 2006 at 04:41 AM

    Hashed tables

    This is the most appropriate type for any table where the main operation is key access. You cannot access a hashed table using its index. The response time for key access remains constant, regardless of the number of table entries. Like database tables, hashed tables always have a unique key. Hashed tables are useful if you want to construct and use an internal table which resembles a database table or for processing large amounts of data.


    The table object ITAB has the type hashed table, a line type corresponding to the flat structure SPFLI from the ABAP Dictionary, and a unique key with the key fields CARRID and CONNID. The internal table ITAB can be regarded as an internal

    template for the database table SPFLI. It is therefore particularly suitable for working with data from this database table as long as you only access it using the key.

    The system finds existing lines using the hash algorithm of the internal table. After the COLLECT statement, the system field SY-TABIX has the value 0, since hashed tables have no linear index.

    I hope it helps.

    Best Regards,


    *Please mark all the helpful answers

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 16, 2006 at 04:19 AM

    What is use of using HASHED TABLE?

    Hashed table is useful when your have to work with very big internal table and to read it with


    The time access is constant !

    Definition of a Hashed Table:

    "Defines the table as one that is managed with an internal hash procedure. You can imagine a hashed table as a set, whose elements you can address using their unique key. Unlike standard and sorted tables, you cannot access hash tables using an index. All entries in the table must have a unique key.

    Access time using the key is constant, regardless of the number of table entries.

    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 to INSERT itab within a LOOP) are not allowed."

    As long as your records has unique key(s), using hash table will give you a huge performance gain when dealing with large dataset. assuming in your case, 10000 record , and if the key is unique, use hash table. The main use of hash tables is for looking up fixed information from a key. So if you have a report that has personnel number and you want to display their name, you could use a hash table.



    types: begin of typ_pernr,

    pernr like pa0001-pernr,

    ename like pa0001-ename,

    end of typ_pernr.

    data: ls_pernr type typ_pernr,

    lt_pernr type hashed table of typ_pernr with unique key pernr.


    select pernr ename into table lt_pernr from pa0001.


    loop at itab.

    read table lt_pernr with table key pernr = itab-pernr

    into ls_pernr.

    write: ls_pernr-ename, itab-data.


    Add comment
    10|10000 characters needed characters exceeded

  • Nov 16, 2006 at 04:23 AM

    Hi Ratna,

    Hash Table follows the Logic of HAsh Algorithm. Suppose take some number like.





    2(square) = 4. Any number which is squared has a last digit as 4 is stored at one place.. Similar to all the case...


    Add comment
    10|10000 characters needed characters exceeded