What Is Hashed Table?

TechDogs Avatar

Disclaimer: Not a round table where things are a blur, but it is sure to be one of those things which are all about helping you get things done. Hashed tables are internal tables used in ABAP programs, where the necessary table record is obtained using the hash function. Like other internal tables, hashed tables are also used to extract data from standard SAP database tables utilizing ABAP programs or objects. However, unlike different 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. Hash functions create the index for each record in a hashed table. The result is a string uniquely identifying each record in the hashed table. The string generated by the hash function is known as a hash code or hash value. With a hashed internal table, you get the best of both worlds: speed and flexibility. You can declare your internal table as a hashed table by adding the keywords' TYPE HASHED TABLE' to its declaration. This makes it accessible to the internal HASH algorithm, allowing fast access times even for large data sets. The unique key must be declared when you're using a hashed table because it's mandatory in this algorithm. Define your unique key with the keyword 'UNIQUE KEY'. Hashed tables are ideal for processing large amounts of data because they allow reads to have costs independent of table size. You're not penalized for having many entries in your database. This makes them preferable to other types of internal tables when there are many reads and few writes happening on them at any given time. A hashed table will always respond in constant time regardless of how many entries are present in it, and you don't have to worry about slowing down if there are too many records!

TechDogs Logo

Join Our Newsletter

Get weekly news, engaging articles, and career tips-all free!

By subscribing to our newsletter, you're cool with our terms and conditions and agree to our Privacy Policy.

  • Dark
  • Light