ERPClimb logoERPClimb
Performance Tuning
ABAP Developmentbeginner 7 min read

Performance Part 2: The Database-First Rule

Preview · a free account unlocks the full lesson

Key takeaway

Apply 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.

In this lessonShow sections

Visual overview

Performance Part 2: The Database-First Rule — learning sheetFlow: Find a SELECT * in your code and replace it with a field list → Replace an ABAP summation loop with SELECT SUM … GROUP BY → Check in ST05 that buffered tables no longer appear as DB accesses. Key ideas: ROUND TRIPS; ROWS; COLUMNS; INDEXES AND KEYS. Watch out: SELECT * on wide tables (e.g. VBAP, MARA with hundreds of fields) moves large amounts of unneeded data — especially costly in loops and on HANA with column storage.ERPClimb.com / ABAP / LESSON 2/10 / LEARNING SHEETPerformance Part 2: The Database-First Rule1 · HOW IT FLOWS1Find a SELECT * in yourcode and replace it witha field list2Replace an ABAP summationloop with SELECT SUM …GROUP BY3Check in ST05 thatbuffered tables no longerappear as DB accesses2 · KEY IDEAS EXPLAINEDRound TripsEach SELECT is a round trip to the database;thousands of small SELECTs cost more than onelarge one.Read data in sets (Parts 4, 5, 7), not per record.RowsWHERE with key fields and selective conditions;ranges from the selection screen.Avoid reading everything and filtering in ABAP(CHECK/DELETE after SELECT).ColumnsField list with only needed fields; INTOCORRESPONDING FIELDS OF or a matching structure.Indexes And KeysPrimary key or secondary index must match theWHERE condition (Part 10).SELECT SINGLE with full key is the cheapest singleread.3 · REMEMBER · WATCH OUTRememberMost ABAP performance problems are database access: too many roundtrips, too many rows, too many columns, missing index use.Five rules: few round trips, few rows (good WHERE), few columns (fieldlist instead of SELECT *), use indexes/keys, let the DB aggregate.Table buffering (SE11 technical settings) makes reads of small, rarelychanged tables (customizing) nearly free — but bypass/unbuffered…!Watch outSELECT * on wide tables (e.g. VBAP,MARA with hundreds of fields) moveslarge amounts of unneeded data —especially costly in loops and onHANA with column storage.4 · IN A REAL PROJECTA customer revenue report read all VBAK and VBAP rows with SELECT * for a year and summed them in ABAP. Itmoved 12 GB of data per run and took 40 minutes. Replacing it with a field-list SELECT and SUM … GROUP BYkunnr, waerk returned a few thousand rows directly from the database; runtime dropped to 45 seconds.Original ERPClimb learning sheet • Verify against your SAP release and edition

Explanation

Part 1 covered how to measure performance; this lesson covers the principles that actually fix most of what those measurements find. Most ABAP performance problems trace back to database access: too many round trips, too many rows returned, too many columns selected, or a failure to use the right index.

Five rules cover most of it: keep round trips few, keep rows few through a good WHERE clause, keep columns few by using a field list instead of SELECT *, make sure indexes and keys are actually used, and let the database do aggregation rather than pulling everything into ABAP to sum it there.

Table buffering, configured in SE11's technical settings, makes reads of small, rarely changed tables — typically customizing tables — nearly free, but certain statements bypass the buffer entirely and quietly lose that benefit.

One particularly costly pattern: SELECT * on a wide table like VBAP or MARA, which can have hundreds of fields, moves a large amount of unneeded data across, which is especially expensive inside a loop and on HANA's column store.

Free account

Create a free account to keep reading

You have read the opening of this lesson. A free ERPClimb account unlocks the rest of it, every other lesson and topic, and your learning history, so you can pick up exactly where you stopped. No card needed.

  • Full explanation
  • Code example
  • Real project scenario
  • Common mistakes
  • Best practices
  • Interview angle

One tap with Google works too. Every topic keeps its first lesson open to everyone.

Keep exploring

Referenced SAP objects

Reviewed reference pages for the objects this page mentions.

Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.