ERPClimb logoERPClimb
Login
All topics
ABAPAdvanced

Performance Tuning

Master ABAP performance tuning with SQL optimization, ST05, SAT, SQL Monitor, internal table strategy, buffering, package processing and real production debugging.

Overview

Master ABAP performance tuning with SQL optimization, ST05, SAT, SQL Monitor, internal table strategy, buffering, package processing and real production debugging.

Lessons in this topic

  • Performance Part 1: Measuring with ST05, SAT and STADMeasure before tuning: STAD to see where the time goes (DB, CPU, wait, RFC), ST05 SQL trace (statements, executions, records, identical selects, execution plan), SAT runtime analysis (hit list, call hierarchy), and ST12 as a combined tool — with a repeatable measuring routine.
  • Performance Part 2: The Database-First RuleApply the database-first rule: read only needed rows and columns, use full keys and indexes, avoid repeated identical reads, aggregate in the database, use buffering where appropriate, and understand why database round trips dominate most ABAP runtimes.
  • Performance Part 3: Tuning in Real Projects — Measure, Fix, VerifyRun performance work like a project: define targets, reproduce with production-like volumes, find the top offenders with STAD/ST05/SAT, fix the biggest item first, verify with numbers, protect with ATC/SCI performance checks and SQL Monitor, and communicate results.
  • Performance Part 4: SELECT Inside LOOP — The Classic Performance KillerRecognise and fix SELECT inside LOOP: why thousands of single reads are slow, how it appears in ST05, rewriting with one set-based read (FOR ALL ENTRIES or JOIN) plus a sorted/hashed lookup table, handling SELECT SINGLE in loops, and hidden cases inside function modules and methods called per row.
  • Performance Part 5: FOR ALL ENTRIES — Correct Use and Hidden RisksUse FOR ALL ENTRIES correctly: the empty driver table trap (reads the whole table), automatic duplicate removal (and why you must select full keys), sorting and deleting duplicates in the driver table, package sizes, large driver tables, and when a JOIN or range is better.
  • Performance Part 6: Internal Tables — Standard, Sorted and HashedChoose the right internal table type for performance: linear search on standard tables, binary search and sorted tables, hashed tables for key lookups, secondary keys, nested loops with WHERE on sorted tables, parallel cursor technique, and memory aspects.
  • Performance Part 7: JOIN vs FOR ALL ENTRIES vs Nested SELECTCompare data retrieval patterns: nested SELECT (worst), FOR ALL ENTRIES (driver from ABAP), INNER and LEFT OUTER JOINs (database does the work), when each fits, join conditions on keys, number of joined tables, buffered tables in joins, and views/CDS for reuse.
  • Performance Part 8: HANA Pushdown with Open SQL, CDS and AMDPMove data-intensive logic to SAP HANA: code-to-data principle, aggregations and joins in Open SQL, CDS views for reusable models with calculations and associations, AMDP for procedural SQLScript, when pushdown helps and when it doesn't, and keeping classic ABAP readable.
  • Performance Part 9: Package Processing for Large Data VolumesProcess millions of records safely: SELECT … PACKAGE SIZE with ENDSELECT, OPEN CURSOR WITH HOLD / FETCH NEXT CURSOR, committing between packages, restartability, memory limits, and parallel processing with background jobs or aRFC for very large runs.
  • Performance Part 10: Indexes, Selectivity and WHERE ConditionsUnderstand how indexes serve WHERE conditions: primary key and secondary indexes (SE11), field order and leading fields, selectivity, conditions that prevent index use (NOT, <>, leading wildcards, functions), client field, checking the execution plan in ST05, HANA specifics, and when (not) to create a new index.

Interview questions covered

  • How would you use parallel processing (aRFC or bgRFC) to shorten a batch run, and what risks do you plan for?
  • What is the risk of using FOR ALL ENTRIES with an empty internal table?
  • Why is SELECT inside LOOP considered bad for performance?
  • A nested LOOP AT itab1 / LOOP AT itab2 WHERE key = itab1-key is a hotspot. How do you refactor it?
  • A report runs for 2 hours on production and 5 seconds in DEV. How do you approach tuning?
  • How do you decide between JOIN, FOR ALL ENTRIES and CDS for performance?
  • You need to reduce end-to-end latency of a Fiori OData list from 8s to under 2s. Walk through your plan.
  • What is ABAP performance tuning?
  • A report reads 900,000 order rows with SELECT * and then filters and sums them in ABAP. How do you improve it?
  • A nightly job loads more than ten million records into one internal table and fails with a memory dump. How do you redesign it?
  • An MM report occasionally reads nearly all purchase order items and runs for hours. What is the likely cause?
  • A report filtered only by posting date and returned millions of rows slowly. How do you use indexes and WHERE conditions to fix it?
  • A month-end job takes three hours and must finish in 30 minutes. How do you run this tuning task?
  • How do you optimise a LOOP AT itab WHERE ... on a large standard table?
  • A job is fast in DEV/QA but slow in production only during month-end. Where do you start?
  • A sales order enhancement added one MARA SELECT per item, and order saves became slow for large orders. How do you fix it?
  • A large sales report repeatedly searches a standard internal table inside a loop. How do you optimise it?
  • A report loads five million billing rows into ABAP and aggregates them by customer and month. How would you improve it on HANA?
  • A slow finance report is blamed on the ALV display. How do you prove where the time really goes?
  • A report selects order headers and then selects items inside the header loop. What alternatives exist, and how do you choose?

How to study Performance Tuning

Performance Tuning has 10 lessons (2 beginner, 5 intermediate, 3 advanced) with about 69 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 26 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 32 mock questions to check recall. Finish with the 5 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.

  • Headers and items are both in the database and filtered by header date. Usually the most efficient read?
  • Which tool collects SQL statement statistics in production over days to find hotspots?
  • Why include full key fields in a FOR ALL ENTRIES field list?
  • When is FOR ALL ENTRIES usually preferred over a JOIN?
  • In a LEFT OUTER JOIN, where should conditions on the right table usually go?
  • When is AMDP the right choice?
  • What is a common problem with SELECT inside LOOP?
  • What should come first in a performance tuning assignment?
  • Why must a FOR ALL ENTRIES driver table be checked for emptiness?
  • Why does COMMIT WORK inside SELECT … PACKAGE SIZE … ENDSELECT cause a dump?
  • Which is the simplest pushdown for totals per customer on HANA?
  • Which WHERE condition is least likely to use an index?
  • Which is a classic ABAP performance anti-pattern?
  • Which index type is generally used for high-selectivity WHERE?
  • What must be checked before using FOR ALL ENTRIES?

Code lab scenarios

  • MODIFY inside LOOP with INTO waUpdate a discount field in place. The report is slow and copies data unnecessarily.
  • SELECT inside LOOP over internal tableA report iterates every VBAK row and fires SELECT SINGLE on KNA1 inside the LOOP. On production it times out for 100k+ orders.
  • SELECT Inside LOOP Causing Thousands of DB CallsA billing report runs for 40 minutes because it reads customer data inside an item loop.
  • FOR ALL ENTRIES Without Empty Table CheckA report suddenly fetches huge data and runs out of memory when the selection returns no driver records.
  • Standard Table Lookup Slowing ABAP RuntimeSAT shows high ABAP time in READ TABLE against a standard table inside a large loop.

Related topics

Interview questions on this topic