ERPClimb logoERPClimb
Login
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?

How to study Internal Tables

Internal Tables has 10 lessons (3 beginner, 5 intermediate, 2 advanced) with about 84 minutes of reading in total. Start with the lesson that matches your level, then read the real project scenario and common mistakes in each one before moving on. After the lessons, say the 45 interview questions out loud in your own words, then check yourself against the model answer in each question (shown once you open it). Use the 34 mock questions to check recall. Finish with the 4 code lab scenarios: read the buggy code first, say what is wrong, and only then open the optimized version.

Mock test questions covered

Try answering each one before you open the mock test; the answer options and scoring are in the Mock Questions tab.

  • Which statement removes all full flights from an internal table in one step?
  • Which statement releases the memory of a large internal table?
  • After READ TABLE fails with sy-subrc = 4, what does the target work area contain?
  • Which statement checks whether a row exists without copying any data?
  • In the parallel cursor technique, how is the first matching inner row found?
  • Why does a sorted inner table speed up LOOP ... WHERE on its key fields?
  • A program reads 30 million rows into one internal table and dumps with TSV_TNEW_PAGE_ALLOC_FAILED. What is the best fix?
  • DELETE ADJACENT DUPLICATES COMPARING customid leaves duplicates in the table. What is the most likely cause?
  • Why should header lines (OCCURS 0 WITH HEADER LINE) be avoided?
  • A large lookup table is always read with its complete unique key. Which table type fits best?
  • Which internal table type gives the fastest read by primary key?
  • For DELETE ADJACENT DUPLICATES FROM itab COMPARING key_fields to reliably eliminate every duplicate row based on those fields, what precondition must be satisfied?
  • To use the FILTER operator on an internal table with a condition like FILTER itab WHERE field = value, what must be true about the source table's key?
  • What occurs when a table expression such as itab[ key = 'X' ] is evaluated and no row matches the specified key?
  • Which construct loops with a field-symbol to avoid row copies?

Code lab scenarios

  • Nested LOOP that scales O(n*m)For every order line, find its schedule line by matching VBELN and POSNR. Runtime explodes as data grows.
  • READ TABLE without a key on a large standard tableThe runtime is fine for demo data but jumps from seconds to minutes as delivery volume grows.
  • BINARY SEARCH without SORT beforehandThe developer added BINARY SEARCH to speed up a READ TABLE but forgot to SORT the target table first. Records go missing intermittently.
  • Standard table vs hashed table for hot lookupsThe SE30/SAT trace shows most runtime is spent in a single READ TABLE call.

Related topics

Interview questions on this topic

Referenced SAP objects

Reviewed reference pages for the objects this page mentions.