A hashed table or hash table is a special type of internal table used in ABAP programs, where by using the hash functionality, the necessary table record is obtained. Like other types of internal tables, hashed tables are also used to extract data from standard SAP database tables by means of ABAP programs or ABAP objects. However, unlike other types of internal tables like standard or sorted, hash tables cannot be accessed using an index. As with database tables, hashed tables also require a unique key.
The features of a hashed internal table include:
To declare an internal table a hashed table, the declaration of the internal table should contain the keywords 'TYPE HASHED TABLE’. This would make the internal table accessible to the internal HASH algorithm.
The unique key must be declared when a HASH table is to be used as it is mandatory in the HASH algorithm. The unique key is defined by the keyword 'UNIQUE KEY’.
A hash table allows the table read to have costs independent of table size.
Hashed tables are preferred over other types of internal tables when there are large data sets with lots of reads and a negligible number of writes. Hashed tables are also ideal for processing large amounts of data.
Regardless of the number of table entries present, the response time for key access in a hashed table remains constant.
Hashed tables work comparatively faster only for full table keys and cannot work for ranges .