Introduction – Why performance is critical in SAP
In SAP projects, performance is not a comfort topic. It drives process reliability, SLA compliance, and the overall perception of the solution by the business. In technical interviews, it often separates a decent developer from a senior consultant.
In S/4HANA, implementation choices show immediately: HANA amplifies good decisions (pushdown, targeted queries) and punishes bad ones (loops, SELECT * and unnecessary ABAP processing).
Business and technical stakes
Impacts are measurable: batch duration, response time, scalability, infrastructure cost, and error rates. Technically, this translates to poorly targeted DB queries, oversized internal tables, and overly verbose code paths.
Optimizing database access
Golden rule in S/4HANA: let the database work. Pushdown through CDS Views and modern Open SQL reduces data volume, network latency, and application load.
Recommended flow User | (UI filters) v CDS View (projection) | (associations, annotations) v CDS View (interface) | (joins, calculations) v HANA database | (pushdown, aggregations)
"ABAP 7.50+ : targeted Open SQL and pushdown
SELECT FROM zso_hdr AS hdr
INNER JOIN zso_itm AS itm
ON itm~so_id = hdr~so_id
FIELDS hdr~so_id,
hdr~customer,
SUM( itm~net_amount ) AS net_total
WHERE hdr~status = @lv_status
AND hdr~created_on BETWEEN @lv_date_from AND @lv_date_to
GROUP BY hdr~so_id, hdr~customer
INTO TABLE @DATA(lt_result).
In a real project, this simple pushdown divided a sales monitoring screen by 6 by replacing ABAP processing with SQL aggregation.
- Limit columns and rows from the SELECT.
- Prefer JOINs, GROUP BY, and HAVING on the DB side.
- Check indexes and selectivity of conditions.
ABAP and internal table optimization
ABAP 7.50+ provides cleaner syntax, but performance depends on internal table structure, sorting, and reducing loops.
"Internal table suited to the use case
TYPES: BEGIN OF ty_line,
so_id TYPE zso_id,
customer TYPE kunnr,
net_total TYPE p LENGTH 16 DECIMALS 2,
END OF ty_line.
DATA lt_data TYPE HASHED TABLE OF ty_line WITH UNIQUE KEY so_id.
Using a HASHED TABLE with a unique key avoids O(n) READ TABLE and secures lookups.
- Avoid SELECT inside loops; group reads instead.
- Use READ TABLE ... BINARY SEARCH on sorted tables.
- Reduce volume before any ABAP processing.
Memory and runtime optimization
In batch processing, memory often becomes the bottleneck. An oversized internal table can exhaust work process memory and trigger dumps.
- Explicitly FREE large tables after use.
- Avoid unnecessary copies (MOVE-CORRESPONDING on big volumes).
- Load in packages (PACKAGE SIZE) for large extractions.
"Extraction in packages SELECT FROM zso_hdr FIELDS so_id, customer, net_total INTO TABLE @DATA(lt_hdr) PACKAGE SIZE 5000. "Processing CLEAR lt_hdr. ENDSELECT.
SAP performance analysis tools
Analysis is tool-driven, not intuition-driven. Start by isolating the symptom, then refine with the right tools.
Quick analysis workflow User signal |-> SAT (ABAP profile) |-> ST05 (SQL trace) |-> SM50/SM66 (WP) |-> ST22 (dump) v Summary + action plan
Real project cases
Here are realistic scenarios encountered on projects, with a reproducible resolution approach.
ST05 analysis: SELECT on large table without index.
Action: add index + filter by period.
Gain: -45% on batch window.
SAT: ABAP processing after DB read.
Action: CDS View with pushdown aggregations.
Gain: response time < 1s.
ST22: TSV_TNEW_PAGE_ALLOC_FAILED.
Action: package extraction + FREE.
Gain: stable batch processing.
Common anti-patterns
- SELECT * when 5 fields are enough.
- SELECT inside a loop without caching.
- FOR ALL ENTRIES without checking empty tables.
- Sorting in ABAP when ORDER BY would be enough.
- Standard internal tables for heavy lookups.
These anti-patterns remain the main causes of red ST05 and saturated SAT traces.
Link to Clean Core and the SAP future
Performance is a pillar of Clean Core: less custom code, more standard, more published APIs. In S/4HANA this means ATC, Released APIs, and ABAP Cloud compliance.
- Limit standard modifications to remain upgrade compatible.
- Use CDS Views and SAP-exposed services.
- Validate continuously with ATC + SCI.
It is also a strong interview argument: you show that performance is an architecture topic, not just local tuning.
Conclusion – Key messages for SAP consultants
- Start by measuring: SAT and ST05 before any optimization.
- Push calculation to HANA with CDS and modern Open SQL.
- Choose the right internal table structure for the use case.
- Document gains and secure with ATC/SCI.