Krit Jiarawattanakul

AI that does real work inside SAP

In my current role I lead the SAP team of a multi-company manufacturer whose ERP has grown since the early 2000s. I use AI for the slow work that blocks an ERP move: reading custom code, writing specs and tests, and making heavy jobs faster. Every result is measured, and a person checks it before it ships.

Current role, 2026. SAP ECC 6.0, a materials shortage report purchasing uses every morning.

A nightly job, four times faster, same output

The report took five and a half hours every night. The first AI pass, given only a plain instruction, brought it under an hour and a half. That was the easy part.

The hard part was proving nothing else changed. Each later build made the code safer, not just faster: identical output, no new ways for the job to fail, step-by-step logging, and one deliberate fix to how it matched MRP data. The final build is also the fastest.

−75%runtime, 5:24:57 to 1:21:38
1.43Mrequirement rows read
0warnings or errors in the final run

Runtime by build

Original code5:24:57
AI, plain instruction1:26:15
Directive v31:26:11
Directive v7, with fixes1:26:11
Step logging added1:23:40
Logging, second pass1:22:28
MRP data match corrected1:22:23
Final build1:21:38

Every figure is start-to-finish time from the SAP job log, same test variant, all runs on the same day.

Where the remaining time goes

Final build, 12 logged steps

01Setup and authorisation0:00
02Open requirements, bulk read, 1,431,445 rows0:14
03Subcontract stock per vendor0:00
04Material groups0:34
05Sales orders and forecast, bulk read0:02
06Weekly shortage buckets, 215,175 materials0:05
07Purchase orders and MRP data, per 5,000 materials1:15:35
08Sort 72,777 output rows0:00
09Prices, texts, stock, dates2:04
10In-transit shipments2:37
11Filters0:00
12Write output0:27

93% of what is left sits in step 7. Logging every step turned "it's slow" into a single target for the next pass.

Current role, 2026. The written instructions ("directives") I give the AI, refined over seven versions.

What made it safe to ship

I don't let the AI decide what "better" means. The directive ranks the goals, and a lower goal can never excuse failing a higher one.

  1. Identical outputSame rows, same values, same order, same file format.
  2. Finishes every runNo new way to stop: memory, time limits, authorisation, file errors.
  3. FasterOnly changes with measured or proven savings.
  4. Lighter on memoryInside a set budget per run.

Each run produces a review for the SAP developer: every change ranked by how likely it is to alter the output, with intended changes called out. People sign off; the AI doesn't.

Seven versions of one directive

Use arrow keys to step through

Gates and completion fixes

The acceptance order above, plus fixes for ways the original job could already fail.

  • Release-aware: only syntax the SAP version actually supports.
  • Asks its intake questions once, then works without hand-holding.
  • Delivers a bilingual (English and Thai) review, the full source, a test matrix and a rollout plan.

Versions were compared on runtime levers, memory, closeness to the original and completion fixes. The best result was a merge: v7 as the base, plus one idea from v3 and one from the plain-instruction run.

Current role, 2026. Batch job history exported from SAP.

Fix what costs the most, not what's loudest

I picked the first program on instinct. To pick the next ones, I had every retained batch job analysed: 29,824 job-step rows covering 2,581 job hours over about ten days.

Seven programs touch 57% of those hours. The report I started with didn't make the top ten, which says something about instinct. The queue now goes by the numbers, adjusted for business deadlines once process owners confirm them.

29,824job-step rows analysed
2,581 hof finished job time
57%of those hours in 7 programs

Share of job hours, top 12 custom programs

Names generalised

BOM comparisonProduction planning19.1%
Shortage with PO, dailyProduction planning11.9%
Shipment reportSales and distribution6.4%
Combined shortageProduction planning5.9%
Outstanding ordersMaterials management5.0%
Outstanding PO scanMaterials management5.0%
Forecast to supplierMaterials management3.6%
Customer extract chainSales and distribution3.4%
Info record queryMaterials management3.4%
Shortage with PO, webReviewed next, see below3.2%
Delivery ordersSales and distribution2.5%
Shortage by POThe case above2.1%

Dark bars are the top seven. Each job counts once per program, so shares overlap where one job runs several programs and don't add up to 100%. Job time includes waiting; it shows exposure, not recoverable savings.

Data and SQL. The part of the work that doesn't show up on a slide.

The SQL and ABAP behind the numbers

Batch tuning and job analytics are database problems first. On the left, the ranking rules above written as SQL. On the right, the single pattern that cost the most time in these reports, before and after.

Ranking rules as SQL

-- T-SQL. One row per program: finished jobs, hours, mean, P95.
WITH finished AS (
  SELECT jobname, jobcount,
         DATEDIFF(second, start_ts, end_ts) AS elapsed_s
  FROM   job_header
  WHERE  status = 'F'            -- finished only
    AND  jobname <> ''
    AND  end_ts >= start_ts         -- crosses midnight safely
),
program_job AS (                      -- a job counts once per program
  SELECT DISTINCT program, jobname, jobcount
  FROM   job_step
  WHERE  program LIKE 'Z%' OR program LIKE 'Y%'
),
ranked AS (
  SELECT p.program, f.elapsed_s,
         ROW_NUMBER() OVER (PARTITION BY p.program
                            ORDER BY f.elapsed_s) AS rn,
         COUNT(*)     OVER (PARTITION BY p.program) AS n
  FROM   program_job p
  JOIN   finished f
    ON   f.jobname = p.jobname AND f.jobcount = p.jobcount
)
SELECT program,
       COUNT(*)                               AS finished_jobs,
       ROUND(SUM(elapsed_s) / 3600.0, 2)      AS job_hours,
       ROUND(AVG(elapsed_s) / 60.0, 1)        AS mean_min,
       MAX(CASE WHEN rn = CEILING(0.95 * n)   -- nearest-rank P95
                THEN elapsed_s END) / 60.0     AS p95_min
FROM   ranked
GROUP BY program
ORDER BY job_hours DESC, finished_jobs DESC, program;

One read per row, versus one read per batch

" A database round trip for every MRP row
LOOP AT lt_mrp INTO ls_mrp.
  SELECT SINGLE ebeln ebelp netpr menge
    FROM ekpo
    INTO ls_po
    WHERE ebeln = ls_mrp-ebeln
      AND ebelp = ls_mrp-ebelp.
  " ... and five more SELECT SINGLEs on
  " EKKO, EINE, EKET, EKES, approvals
ENDLOOP.
1.4M → 6single-row reads replaced by bulk reads
135M → 45krow checks after fixing a loop that re-scanned the whole result

From the review of the next report in the queue (shortage with PO, web). These two figures and its projected drop from over 7 hours to under 1 hour are modelled from code and job history, not yet measured in production.

Current role, 2026. Request for AI licences for the SAP team, as operating expense.

An AI business case built on measured hours

I didn't ask for AI on a vendor's slide. I asked for three licences with five finished cases as evidence: what each would have taken by hand, how long the AI ran on its own, and how much people's time it took to direct and check.

84 hof work delivered
17.5 hof people's time to direct and review
1.7×the full year's licence cost, recovered in one week

Value is counted as extra work capacity at the team's cost rate, not as cash saved. Unproven gains, such as faster ERP vendor discovery, were listed but left out of the total.

Five finished cases, one person, one week

Hours

CaseBy handAI alonePeopleGained
Optimise the nightly job (above)242420
Functional specification for it10137
Test script, 32 cases60.51.54.5
Customer ERP integration proposal283721
Inventory of SAP files by area and age161214
Total847.517.566.5

Try it with your own team's numbers

Same formula as the request

Measured in the pilot: 3.8. The request assumed 2.
Average cost of a person-hour, not salary.
Converted at THB 33.7 per US dollar.
88×value of the extra capacity, against licence cost
3,432hours of extra work a year
THB 2.15Mcapacity value a year
THB 24,264licence cost a year
38.8 hgained hours needed to break even

Current role, 2026. Company-wide AI policy and use-case review.

Rules before scale

AI is only useful at company scale if legal, security and the business trust it. So the policy, the risk review and the reusable instructions came with the pilot, not after it.

AI policy, English and Thai

Fifteen sections, built on the company's data classification and PDPA duties.

  • Principles
  • Permitted and prohibited use
  • Data classes by AI tool
  • Risk tiers and approval
  • AI lifecycle
  • Security and privacy
  • Intellectual property
  • Human oversight
  • AI agent controls
  • Procurement
  • Incidents and exceptions
  • Training and review

15 use cases, risk-reviewed

12 in use and 3 proposed, each with its risk tier, data rules, approval steps and the policy clauses it relies on.

12in use
3proposed

One rule I hold to: a shared instruction file never replaces approval, connector permissions or the provider's data-retention settings.

12 reusable directives

Written instructions the team runs instead of starting from a blank prompt each time.

  • ABAP optimisation
  • ABAP to functional spec
  • ABAP to technical spec
  • ABAP to test script
  • AS-IS blueprint
  • Module blueprint
  • Custom object catalogue
  • Role and access documents
  • Team weekly report
  • One-to-one meeting deck
  • Branded document standard
  • Bilingual HTML documents

The AS-IS blueprint, built the same way, is on the SAP and process page.

Personal project. All figures on this page are invented for illustration.

Off the clock: a personal analytics lab

I run my own investments the way I would run an IT portfolio: one data model, refreshed on a routine, checked for integrity, and turned into a monthly report with a recommendation and a risk register.

The pipeline pulls fund prices into an Excel data model, and an AI-assisted build turns it into a 16-section HTML report: what changed, a scorecard, fund versus index, correlation, macro events, stress tests and a data-integrity check at the end.

  • Excel data model
  • Price history
  • Weekly returns
  • Correlation
  • Stress tests
  • HTML5 and Chart.js
  • Print-ready A4

What actually moves the portfolio

Correlation of weekly returns, mock data

Hover or tap a cell. Two holdings that move together give less protection than their names suggest.

Hiring a Head of IT, IT Director or CIO?

Open to Head of IT, IT Director and CIO roles in Thailand and Southeast Asia.

krit.jiarawattanakul@gmail.com
Phone
+66 92 775 9933
Based in
Bangkok, Thailand
Languages
Thai and English
Also at
hirekrit.com