SAP ABAP - Hashed Internal Table (Non-Index Table) With Example.
Submitted By: Shilpa Gunjan (L&T Infotech)
- Hashed Internal Tables are the most appropriate type of table where the main operation or access is via key and not index. Hashed tables cannot be accessed via index.
- Like database tables, hashed tables too have a unique key. Hashed tables cannot have a NON-Unique key. The key has to be Unique and hence one must specify UNIQUE keyword in the table definition.
- The response time for key access remain constant, regardless of the number of table entries because the access is carried out via a hash algorithm.
- If a hashed table is accessed with a key that is different to the unique table key, the table is handled like a standard table and searched linearly according to the entries. Same applies for partial key also.
- Hashed table should only be used where the unique key is the only type of access, particularly if there is a need to process very large table.
- Using hashed internal tables the 100,000th record is read just as quickly as the 1st making it much faster than even a binary search.
SYNTAX:
DATA: <Internal table name> TYPE HASHED TABLE OF <Structure/Types/Db Table> WITH UNIQUE KEY <key1> <key2>…..
Examples:
1) Hashed Internal Table Performance When The Key Used Is Table’s Partial Key.
2) Hashed Internal Table Performance When The Key Used Is Table's Key.
RELATED POSTS:
- INTERNAL TABLES - Introduction, Advantages & Types Of Internal Tables.
- STANDARD INTERNAL TABLE (Index Table) - Introduction With Sample Programs.
- SORTED INTERNAL TABLE (Index Table) - Introduction, Advantages & Performance.
- SORTED INTERNAL TABLE With Key Access (Performance) - Sample Program.
- SORTED INTERNAL TABLE With INDEX Access (Performance) - Sample Program.
- HASHED INTERNAL TABLE (Non-Index Table) - Introduction, Advantages & Performance.
- HASHED INTERNAL TABLE - Partial Key Access (Performance) - Sample Program.
- HASHED INTERNAL TABLE - Table's Key Access (Performance) - Sample Program.
Your suggestions and comments are welcome in this section.
Please mail all your contributions to administrator@abapmadeeasy.com We request you to mention your Name, Designation, Experience & Organization you are working for. Your posts will be verified and posted in this site with your name.