>80% faster SAP reporting through AI-led optimization, zero manual effort.
Autonomous agents optimized runtime performance of critical SAP reports for a large textile manufacturer, resolving timeouts, stabilizing execution, and eliminating operational risk, without altering business logic or report output.
Business-critical reports were failing under production load.
Our client, a large textile manufacturer, was running SAP S/4HANA, having completed migration through another SI, but custom ABAP was not HANA-compliant and was causing performance failures. Over 15+ years of accumulated customization had been carried over into the S/4HANA landscape without HANA-compliant optimization.
The immediate crisis was operational. Business-critical reports, including the Purchase Register, the Order-Delivery-Bill Status, and the GST-Report, were timing out after 20+ minutes. The finance team was forced to run reports one day at a time, manually stitching results to keep operations moving.
Key pain points included:
Legacy code and poor performance: Thousands of lines of custom ABAP with outdated patterns (e.g. SELECT * inside nested loops) were not optimized for HANA, causing severe runtime bottlenecks. Complex nested loops without sorted reads or binary search meant some reports ran exponentially slower than they should.
High manual remediation effort: Traditional manual refactoring was estimated at 1–2 weeks per program. This approach relied on a few “hero” developers, creating a delivery risk if those key people were unavailable.
Quality and compliance concerns: Ensuring rewritten code followed SAP HANA clean core best practices was nearly impossible by hand. The legacy code lacked documentation and clarity, making it error-prone and hard to audit.
“Traditional manual refactoring was estimated at 1–2 weeks per program. Across the full scope of programs, this amounted to approximately one month of sequential developer effort.”
Autonomous AI-Led Remediation of Legacy ABAP
Sookti AI deployed an autonomous AI agent to handle the code optimization end-to-end. Without any human intervention, the agent transformed and optimized the client’s codebase in minutes. The workflow included:
Throughout this automated workflow, the Sookti AI agent handled the entire conversion without a human in the loop. No manual coding or debugging was needed. Sookti AI essentially became an expert ABAP developer and tester that worked at machine speed. Transformation of each program completed in minutes. Automated regression testing confirmed 100% functional parity before delivery.
Data-driven improvements measured on live enterprise workloads. Results below represent a subset of optimized programs from a broader SAP performance initiative.
SAP Runtime Analysis (SAT) DEV 300

ZPP_CYCLE_TIME_REPORT. Before: 21.0 sec / After: 13.3 sec (Sookti AI). 37% improvement on live production workload.


ZGSTR1 Legacy version: memory dump, could not run. Sookti AI optimized version (ZGSTR1_SKT): stable execution, 55% reduction in memory consumption (7,377 kB → 3,233 kB), 55% reduction in runtime. Output matched 100% against the source version on QA data.

ZPURCHASE_REGISTER. Before: 3.1 sec / After: 1.85 sec (Sookti AI). 41% improvement measured on live production workload.

ZPP_CYCLE_TIME_REPORT. Before: 22.1 sec / After: 5.8 sec (Sookti AI). 74% improvement, 81% reduction in external DB accesses, measured on live production workload.
All legacy reports exceeded acceptable execution limits and failed to complete. Results showed autonomous AI restored business-critical reporting performance without manual remediation or regression risk.
Pattern 1: Bulk Retrieval + Binary Search
Replacing loop-based database access with bulk retrieval and indexed in-memory processing. Database hits cut from O(n) per iteration to a single bulk SELECT followed by O(log n) binary search reads.
LOOP AT t_final ASSIGNING <l_fs_final>.
" Performance Anti-pattern: DB hit in loop
SELECT SINGLE audat FROM vbak INTO (audat)
WHERE vbeln = <l_fs_final>-sono.
ENDLOOP.IF t_final IS NOT INITIAL.
" Bulk Retrieval using FOR ALL ENTRIES
SELECT vbeln, audat FROM vbak
INTO TABLE @DATA(lt_vbak)
FOR ALL ENTRIES IN @t_final
WHERE vbeln = @t_final-sono.
SORT lt_vbak BY vbeln. " Prepare for Binary Search
ENDIF.
LOOP AT t_final ASSIGNING <l_fs_final>.
" O(log n) Read instead of DB call
READ TABLE lt_vbak INTO DATA(ls_vbak)
WITH KEY vbeln = <l_fs_final>-sono
BINARY SEARCH.
IF sy-subrc = 0.
audat = ls_vbak-audat.
ENDIF.
ENDLOOP.Pattern 2: Parallel Cursor Technique (O(n²) → O(n+m))
For nested dataset aggregation, agents implement parallel cursors to scan two sorted tables simultaneously, reducing complexity from O(n²) to nearly O(n+m), dramatically faster for large production workloads.
LOOP AT it_final1 ASSIGNING FIELD-SYMBOL(<gv>).
CLEAR: <gv>-bundle, <gv>-fkimg.
LOOP AT it1_final ASSIGNING FIELD-SYMBOL(<gv1>)
WHERE delv_no = <gv>-delv_no
AND packing_type = <gv>-packing_type
AND length = <gv>-length
AND width = <gv>-width.
<gv>-bundle = <gv>-bundle + <gv1>-bundle.
<gv>-fkimg = <gv>-fkimg + <gv1>-fkimg.
ENDLOOP.
ENDLOOP." Sort once for Parallel Cursor logic
SORT it1_final BY delv_no packing_type length width.
DATA: lv_idx TYPE sy-tabix.
LOOP AT it_final1 ASSIGNING FIELD-SYMBOL(<gv>).
CLEAR: <gv>-bundle, <gv>-fkimg.
LOOP AT it1_final ASSIGNING FIELD-SYMBOL(<gv1>) FROM lv_idx.
IF <gv1>-delv_no < <gv>-delv_no.
CONTINUE. " Skip to start of match
ELSEIF <gv1>-delv_no > <gv>-delv_no.
EXIT. " Early exit: no more matches
ELSE.
lv_idx = sy-tabix. " Update cursor
<gv>-bundle += <gv1>-bundle.
<gv>-fkimg += <gv1>-fkimg.
ENDIF.
ENDLOOP.
ENDLOOP.“Sookti AI compressed what would have taken our team a month of manual remediation into a single day of agent runtime, while simultaneously baking in HANA best-practices we wouldn't have implemented manually.”
Engagement Details
Ready to Unlock Similar Performance Gains?
Run a controlled pilot on your most critical SAP workloads and validate measurable results before scaling enterprise-wide.
Book a call with us or write to: aditya@sookti.ai | tanushree@sookti.ai

