Performance
Quick answer
On HANA, push logic to the database (CDS, Open SQL with aggregation) and avoid row-by-row ABAP processing.
Key takeaways
- Never SELECT inside a loop, read all needed data once, then work in memory.
- Select only needed columns and rows, avoid SELECT * and always use a WHERE.
- Use appropriate indexes, ensure your WHERE matches an index; add one if needed.
- Watch out: SELECT in a loop, the number-one offender.
The database rules (most important)
- Never SELECT inside a loop, read all needed data once, then work in memory.
- Select only needed columns and rows, avoid SELECT * and always use a WHERE.
- Use appropriate indexes, ensure your WHERE matches an index; add one if needed.
- Aggregate/join in the database (Open SQL, CDS) rather than in ABAP loops, especially on HANA (code-to-data).
Internal-table rules
- Use SORTED/HASHED tables (or BINARY SEARCH) for repeated lookups instead of linear READ.
- Loop with ASSIGNING FIELD-SYMBOL to avoid copying rows.
- Avoid nested loops over large tables; use keyed access or joins.
Measure, do not guess
" tools: SAT (runtime analysis), ST05 (SQL trace),
" ST12 (single-transaction trace), ST03 (workload)HANA changes emphasis
On HANA, push logic to the database (CDS, Open SQL with aggregation) and avoid row-by-row ABAP processing. The classic anti-patterns (SELECT in loop, SELECT *) hurt even more when the database is fast and the bottleneck becomes needless round-trips.
Common pitfalls
- SELECT in a loop, the number-one offender.
- SELECT * / no WHERE, reading too much.
- Linear reads and nested loops on big internal tables.
Want to learn this properly?
Our live, instructor-led SAP Training covers this hands-on, with real projects and a certification path.
Check your understanding
Which statement is true of Performance?
- A. ST22 is the SAP transaction code for ABAP Dump Analysis (Basis/ABAP).
- B. The classic anti-patterns (SELECT in loop, SELECT *) hurt even more when the database is fast and the…
- C. This troubleshooting hub covers the recurring problems in SAP operations, dumps, RFC and IDoc errors…
Show answer
B. The classic anti-patterns (SELECT in loop, SELECT *) hurt even more when the database is fast and the…
Covered in the “HANA changes emphasis” section of this lesson.
Which of these also applies to Performance?
- A. Aggregate/join in the database (Open SQL, CDS) rather than in ABAP loops, especially on HANA (code-to-data).
- B. Bad master data (BOMs, lead times), wrong plans.
- C. Guessing instead of using the reference tools.
Show answer
A. Aggregate/join in the database (Open SQL, CDS) rather than in ABAP loops, especially on HANA (code-to-data).
Covered in the “The database rules (most important)” section of this lesson.
Which part of the Learn SAP curriculum covers Performance?
- A. SAP administration
- B. SAP certification
- C. SAP ABAP development
Show answer
C. SAP ABAP development
This lesson sits in the SAP ABAP development section of the Learn SAP course.