ABAPIntermediate
Internal Tables
Master standard, sorted and hashed internal tables with real ABAP performance, debugging and interview scenarios.
Overview
Master standard, sorted and hashed internal tables with real ABAP performance, debugging and interview scenarios.
Lessons in this topic
- APPEND, INSERT, MODIFY, DELETE and COLLECTUnderstand the most important internal table modification statements and their risks.
- Internal Tables in ABAP β from basics to performanceStandard, Sorted, Hashed tables, secondary keys, and how to pick the right one so your reports scale.
- Choosing the Right Table TypeAccess complexity, key design and secondary keys.
- LOOP Patterns: ASSIGNING, WHERE, GROUP BY, VALUE and REDUCELearn practical looping patterns from classic ABAP to modern ABAP syntax.
- Removing Duplicates and Building Unique DatasetsLearn practical ways to remove duplicates and prepare safe driver tables.
- Nested LOOP Optimization and Parallel CursorLearn how to replace expensive nested loops with better lookup patterns.
- Work Area vs Field Symbol vs Data ReferenceUnderstand how rows are copied, referenced and modified in internal table processing.
- READ TABLE, sy-subrc and Modern Table ExpressionsLearn safe read patterns using READ TABLE, TRANSPORTING NO FIELDS, line_exists and table expressions.
- BINARY SEARCH, SORT and Secondary KeysUnderstand when binary search helps, when it fails, and when secondary keys are better.
- Memory Management and Large Internal TablesUnderstand how internal tables consume memory and how to design high-volume processing safely.
Interview questions covered
- What is the difference between LOOP AT itab INTO wa and LOOP AT itab ASSIGNING <fs>? Why does this distinction matter for performance?
- A background job processes a large internal table and occasionally dumps with a short dump related to memory exhaustion, but only when run against certain company codes with more data. What internal-table-specific patterns would you look for in the code as likely culprits?
- You need to build an internal table structure to hold sales order header data along with a variable number of item lines per order (a nested/hierarchical structure). How would you model this using internal tables?
- You are reviewing a performance-critical program that uses modern ABAP table expressions (itab[ key = value ]) instead of READ TABLE, and inline declarations with VALUE/REDUCE constructs to build internal tables. As a senior consultant, what performance and readability trade-offs would you highlight to the team?
- What does the BINARY SEARCH addition do in a READ TABLE statement, and what precondition must be met for it to work correctly?
- A program uses APPEND to add rows into what was declared as a SORTED table, and it throws a runtime error intermittently only for certain input data. What's happening and how would you fix it?
- How would you design internal table processing for a framework method that must merge data from multiple heterogeneous sources (different internal tables with overlapping but not identical structures) into one consolidated result table, while keeping the design extensible for future new sources?
- A custom program compares two internal tables (an 'old' snapshot and a 'new' snapshot of the same business data) to identify inserted, deleted, and changed records for a delta interface. How would you design this comparison efficiently using internal tables?
- Your program builds an internal table of open purchase order items and needs to compute a running total per vendor, then also needs the final list sorted by vendor with a subtotal line after each vendor's items. How would you design the internal table structures and logic for this?
- Your team is designing a reusable class method that accepts an internal table as an importing parameter and must work regardless of whether the caller passes a standard, sorted, or hashed table. What design considerations are important here?
- As a senior consultant, how would you explain the memory and performance implications of assigning one internal table to another (itab2 = itab1) versus using field symbols or references, especially for large tables with nested/deep structures?
- You inherited a program where a field symbol is assigned inside a loop using ASSIGN COMPONENT idx OF STRUCTURE wa TO <fs>, and occasionally the program dumps with an 'unassigned field symbol' error only for certain input files. How would you debug this?
- A high-throughput interface program processes internal tables with several hundred thousand rows and needs to remove duplicate rows based on a subset of fields, not the full row. What internal table techniques would you use to do this efficiently, and what pitfalls exist with the standard DELETE ADJACENT DUPLICATES approach?
- You are asked to redesign a poorly performing report that builds an ALV output by looping over a header internal table and, for each header, looping over a full standard items internal table using a WHERE condition to find matching items (LOOP AT items WHERE vbeln = header-vbeln). What internal table redesign would you propose and why?
- A report using SELECT ... FOR ALL ENTRIES IN lt_driver sometimes returns fewer rows than expected, and investigation shows lt_driver had duplicate key values before the SELECT. What internal-table-related behavior explains this and how would you fix the underlying program?
- What are the three types of internal tables in ABAP (Standard, Sorted, Hashed) and how do they differ in terms of key definition and access?
- In a debugging session, you find that a program modifies rows of an internal table inside a LOOP using MODIFY itab FROM wa, but some rows are not getting updated as expected even though the logic looks correct. What internal-table-specific issues would you investigate?
- You need to build a highly reusable internal table-based caching mechanism inside a long-running framework class, where thousands of different keys will be looked up repeatedly across many method calls without re-querying the database each time. What internal table design would you use and what pitfalls would you guard against?
- How would you decide between using a standard internal table with SORT + BINARY SEARCH versus declaring the table directly as a SORTED or HASHED table type, from a design and maintainability perspective?
- What is the purpose of a secondary key (secondary index) on an internal table, and how do you define one?