Hello,

Sign up to join our community!

Welcome Back,

Please sign in to your account!

Forgot Password,

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

You must login to ask a question.

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

SAP EWM Help Latest Questions

  • 0
  • 0
DPM125

Types of Internal Tables in ABAP

SAP defines three main types of internal tables based on their structure and access method:

1. Standard Table (STANDARD TABLE)
  • Default type if nothing is specified.

  • Entries are stored unsorted (in the order you append them).

  • Index-based access (like arrays).

  • Duplicate entries allowed.

  • Access time:

    • By index → very fast (O(1))

    • By key → linear search (O(n))

Use Case: Small-to-medium datasets where duplicates are needed, sequential processing.

 

DATA: it_mara TYPE STANDARD TABLE OF mara WITH DEFAULT KEY,
wa_mara TYPE mara.

SELECT * FROM mara INTO TABLE it_mara UP TO 10 ROWS.
READ TABLE it_mara INTO wa_mara INDEX 5. ” Access by index

 

2. Sorted Table (SORTED TABLE)
  • Entries are always stored in a sorted order (by key).

  • No need to SORT explicitly.

  • Unique or non-unique keys possible (depending on definition).

  • Binary search used internally for key access.

  • Access time:

    • By key → fast (O(log n))

    • By index → slower than standard

Use Case: When you frequently read data by key and want it sorted automatically.

 

DATA: it_mara_sorted TYPE SORTED TABLE OF mara
WITH UNIQUE KEY matnr.

SELECT * FROM mara INTO TABLE it_mara_sorted UP TO 10 ROWS.
READ TABLE it_mara_sorted WITH TABLE KEY matnr = ‘MAT001’
INTO DATA(wa_mara).

 

3. Hashed Table (HASHED TABLE)
  • Entries are stored in hash algorithm format (like a dictionary).

  • Only unique keys allowed.

  • No index access → can only be accessed via key.

  • Access time: By key → constant (O(1)) on average.

  • Best for large datasets when you always access by key.

Use Case: Fast key-based lookups, like material master lookup by MATNR.

 

DATA: it_mara_hashed TYPE HASHED TABLE OF mara
WITH UNIQUE KEY matnr.

SELECT * FROM mara INTO TABLE it_mara_hashed UP TO 1000 ROWS.
READ TABLE it_mara_hashed WITH TABLE KEY matnr = ‘MAT001’
INTO DATA(wa_mara).

Summary : 

Type Sorted? Duplicates? Access by Index Access by Key Performance
Standard No Yes Yes Linear Search Best for small, sequential
Sorted Yes Optional Yes Binary Search Best for ordered + key access
Hashed N/A No No Hash Search Best for large, key-only access

Related Questions

Leave an answer

Leave an answer