Skip to main content

Hashed vs Sorted Tables

IntermediateInternal Tables⏱ 15 min

Task

You are required to read records efficiently by material number. Choose and use the correct internal table type to achieve optimal read performance.

Write Your ABAP Code

ABAP Editor
Loading...
📥 Sample Input & Output
MATNR   WERKS   MENGE
A100    1000    10
A200    2000    5

Input MATNR: A100
Output: Record found
💡 Hint

Hashed tables provide O(1) access using a unique key.

✅ View Reference Solution
DATA: it_hash TYPE HASHED TABLE OF ty_mat
      WITH UNIQUE KEY matnr.

READ TABLE it_hash INTO DATA(ls_row)
     WITH KEY matnr = lv_matnr.