Back to Blog
ABAPInternal TablesPerformance

Understanding ABAP Internal Tables: Types, Operations, and Best Practices

Master ABAP internal tables ÔÇö standard, sorted, and hashed table types with practical examples and performance tips.

A

Admin

Monday, 9 February 2026

What Are Internal Tables?

Internal tables are ABAP's primary data structure for storing and processing collections of data in memory. They are analogous to arrays or lists in other programming languages but with more powerful built-in operations.

Types of Internal Tables

1. Standard Tables

Standard tables use a linear index for access. They allow duplicate entries and are best when you need sequential access or don't have a unique key.

DATA: lt_employees TYPE STANDARD TABLE OF ty_employee,
      ls_employee  TYPE ty_employee.

APPEND ls_employee TO lt_employees.
READ TABLE lt_employees INDEX 1 INTO ls_employee.

2. Sorted Tables

Sorted tables maintain data in sorted order by key. They're optimized for binary search and ideal when you frequently search by key.

DATA: lt_sorted TYPE SORTED TABLE OF ty_employee
      WITH UNIQUE KEY emp_id.

3. Hashed Tables

Hashed tables provide O(1) access time via a hash algorithm. Perfect for large datasets with unique key lookups.

DATA: lt_hashed TYPE HASHED TABLE OF ty_employee
      WITH UNIQUE KEY emp_id.

Modern ABAP Table Expressions

In modern ABAP (7.40+), you can use inline expressions for cleaner code:

" Table expression - read with key
DATA(ls_emp) = lt_employees[ emp_id = '12345' ].

" FILTER expression
DATA(lt_active) = FILTER #( lt_employees WHERE status = 'A' ).

" FOR expression - like map/select
DATA(lt_names) = VALUE string_table(
  FOR wa IN lt_employees ( wa-name ) ).

Performance Tips

  • Use hashed tables for single-record lookups on large datasets
  • Avoid LOOP AT ... WHERE on standard tables ÔÇö use sorted or hashed
  • Use BINARY SEARCH with sorted standard tables
  • Prefer table expressions over READ TABLE for cleaner code