All topics
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

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?
  • 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?
  • 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?
  • A colleague wrote code that builds a RANGES-style selection table dynamically to filter a SELECT statement based on user input from a selection screen, but sometimes the filter behaves unexpectedly (returns too many or too few records). What internal table design aspects would you check?
  • You need to process 2 million material master records in a background report, applying business logic per record and writing results to a Z-table. Reading all 2 million rows into a single internal table at once causes memory pressure. How would you redesign the internal table handling for this?

Related topics

Interview questions on this topic