← The Machine Room · Case File 004 — Financial Modelling OS Reconciling · --:--:-- GST · Sheet 1 of 7
CASE FILE · FINANCIAL MODELLING OS · FP&A / DATA ENGINEERING DWG NO. AH-CS-004

One pooled ledger hid ten businesses. This system draws each one its own P&L — reconciled to SAP, to the dirham.

A management operating system for a UAE distribution group: deterministic rule engines read a 229-table SAP lake and turn every posting into per-vertical P&Ls, so a margin move becomes a diagnosis, an owned action, and a journaled consequence — not a mystery.

LAKE · 229 OF 239 SAP TABLES · READ IN PLACE
→ 32-RULE ROUTING → 10 VERTICAL P&LS
→ P/V/M DIAGNOSIS → ACTION → CONSEQUENCE

REVENUE TIES TO SAP TRIAL BALANCE — TO THE DIRHAM,
FROZEN AS A REGRESSION BASELINE  VERIFIED
5 min
AUDIT-PACK CM2 → NAMED CUSTOMERS, SKUS, VENDORS
DESIGN TARGET, STATED IN PRODUCT DOCS  CLAIMED
Drawn byAbu Huraira Mukhtar
RoleArchitect & Lead Engineer
Build window2026-03 → Live · In Cutover
Scale229 Tables : 10 P&Ls
ClientWithheld · UAE Distribution Group
StatusProduction Cutover · RBAC Hardening
Source27 Design Docs · 6 Research Briefs
Sheet1 of 7
SHEET 2 OF 7 · ABSTRACTGENERAL NOTES APPLY

01 · The ledger is the operating system

This is not a reporting platform. It is the operating system a distribution business is run through — the product's own manifesto opens with that refusal, and every screen is audited against it.

The client is a UAE distribution group: one business unit, roughly ten verticals, buying from global principals and selling to contractors, developers and government. SAP is the system of record and management cannot read it. So the machine reads it for them — and refuses to summarize. Every number a manager sees is the output of a named, deterministic query against one semantic layer; the language model is allowed to write sentences, never numbers.

What your vertical heads get is not a dashboard. It is their own P&L, down to net profit, with an accountability line drawn at exactly the costs they control — and behind every line, the machine's four standing questions: what is this, what caused it, what should I do, did it work.

GENERAL NOTES
1 · 229 OF 239 SAP TABLES SCOPED IN · 10 IGNORED · 8 REQUESTED VERIFIED
2 · 36 SAP EXTRACTS · 11,661 COLUMNS CATALOGUED
3 · ATHENA / ICEBERG · PYTHON ENGINES · FASTAPI · NEXT.JS
4 · DETERMINISM RULE — SQL FOR NUMBERS, LLM FOR WORDS ONLY
5 · CLIENT WITHHELD — DETAIL AVAILABLE IN INTERVIEW
SHEET 3 OF 7 · FIELD NOTESTHE BEFORE-STATE

02 · Month-end, a margin moved, and nobody can say why

Somewhere this month a finance analyst is hand-cutting a SAP dump into Excel, again, so that a room of executives can look at one number and fail to explain it.

The organization stores every cost at business-unit level. Ten verticals — HVAC, pumps, elevators, the rest — share one pooled P&L, so no vertical head has ever seen their own bottom line, and no one can say which of the ten actually makes money. SAP knows, in its way: cryptic profit centers, material groups, document types. Nobody in the meeting speaks that language.

So the monthly ritual runs on a deck of disconnected spreadsheets. Contribution margin is down; the room asks why — price, volume, mix? The honest answer is that finding out means another week of Excel, and the meeting is now. FIG. 1 shows the loop as observed. The question survives it; the answer never arrives.

OBSERVED
COSTS — POOLED AT BU LEVEL · TEN BUSINESSES, ONE P&L
VERTICAL HEADS — ACCOUNTABLE, YET BLIND TO OWN ECONOMICS
MONTHLY VIEW — HAND-CUT SAP DUMPS · FACTS DRIFT PER DECK
CAUSE OF A MARGIN MOVE — UNKNOWN AT MEETING TIME
PC 2XXX · DA SAP · RAW DUMP, UNREADABLE EXCEL · HAND-CUT MONTHLY THE DECK · DISCONNECTED CM2 ▾ 180 BPS WHY? MIS MEETING · MONTHLY CAUSE: UNKNOWN — ANSWER DUE NEXT MONTH-END.
FIG. 1 — THE MONTH-END LOOP, AS OBSERVEDSCALE — ONE QUESTION : ONE MONTH-END
SHEET 4 OF 7 · SECTION A-ACUT THROUGH THE RUNNING LEDGER

03 · Ten P&Ls, one loop, no residual

VBRK · VBRP BSEG · BKPF BSID · BSIK COEP · COPA FAGLFLEXA LIKP · KONV A700 · EKPO SAP → ICEBERG LAKE 229 OF 239 TABLES · READ IN PLACE SEMANTIC LAYER R01 R32 ROUTING LADDER 32 RULES · TIME-AWARE SEE DETAIL C 10 VERTICAL P&LS — ONE CUT SHOWN REV GP CM1 CM2A YOUR ACCOUNTABILITY LINE — DETAIL B CM2B ALLOCATED — NOT YOUR LEVER NP TIES TO SAP TRIAL BALANCE — TO THE DIRHAM GAP VS TARGET PRICE VOLUME MIX WIN-RATE 3/5 ACTION — DRAFTED FROM THE CATALOG OWNER + DEADLINE ATTACHED HUMAN APPROVES · NEVER AUTONOMOUS CONSEQUENCE — JOURNALED, SNAPSHOT FROZEN, OUTCOME LANDS ON THE GAP SAP POSTING → EXPLAINED MARGIN → OWNED ACTION → OUTCOME · TARGET 5 MIN — CLAIMED
FIG. 2 — SECTION A-A · THE LEDGER LOOPEVERY NUMBER — A NAMED SQL QUERY
STATION 1 · 229 OF 239 TABLES

1The lake

Thirty-six SAP extracts land in an Iceberg lake — 229 of the 239 catalogued tables scoped in, table by table, with a written verdict on each. A data-residency rule holds everywhere: no SAP copy ever leaves the lake. Engines query it in place; the app database holds reference and audit schemas only, never a fact.

STATION 2 · 32 RULES · DETERMINISTIC

2The ledger

A 32-rule priority ladder classifies every sales line into one of ten vertical buckets — time-aware, because profit centers were born on different dates and history misroutes without it. Same row, same rules, same period: same output, always. The bucket totals are frozen as a regression baseline; any refactor that moves a number by one dirham fails the gate.

STATION 3 · PRICE / VOLUME / MIX

3The diagnosis

When CM2a misses target, the machine decomposes the gap — price, volume, mix, new and lost business — at SKU-customer grain, rolled up only for display. The bridge must sum exactly: no “other” bar, no residual line. If the math doesn't sum, the rule is to fix the math, not the chart.

STATION 4 · DRAFT-ONLY, BY DECISION

4The action

Diagnosis ends in a drafted action from a playbook catalog — each playbook carrying its own track record — with an owner and a deadline attached. Not a dashboard to browse: the three things that need attention, pushed to the channels people already live in. A human approves anything that moves money. Always.

STATION 5 · THE LOOP CLOSES

5The consequence

Every decision is journaled with an expected outcome and a frozen snapshot of the numbers as they stood — immutable, so hindsight can't rewrite it. When the outcome arrives, the arc lands back on the same ledger line the decision tried to move. This loop is the whole thesis — the same dashed arc you saw closing on the tile.

DETAIL B · SEE FIG. 2, ACCOUNTABILITY LINE

The margin that split in two

The tempting design: hold each vertical head to full CM2. But that line carries salaries HR sets and warehouse shares Finance allocates — judging people on levers they don't hold guarantees a legitimate argument with the platform.

Chose to split CM2 into CM2a — pricing, mix, marketing, travel: “your accountability line” — and CM2b, allocated and explicitly de-emphasized as “not your lever,” because accountability people accept beats precision people argue with. Cost: a longer ladder and a harder finance conversation. Revisit when allocation drivers become something a vertical head can actually move.
DETAIL C · SEE FIG. 2, ROUTING LADDER

Rules must earn their existence

The tempting design: see a misattributed dirham, add a rule. Aggregate statistics lie about sub-populations — a reference field that is “a customer PO on average” carries the seller's own invoice number on most retentions.

Chose a standing discipline: every new rule must be motivated by one specific failed row, probed field-by-field against the lake, and may fire only on a known index hit — false-positive-safe by construction — because a rule added on a hunch corrupts quietly and forever. Cost: slower; a forensic probe skill had to be built first. Result: an 18-rule AR ladder that holds under reconciliation.
SHEET 5 OF 7 · REVISION HISTORYALL ENTRIES TRACEABLE

04 · What broke, row by row

A ledger that claims to be trustworthy owes you its corrections. Every row below traces to a numbered design doc, a commit, or a re-frozen baseline.

The pattern across them: when a number came out wrong, the fix was never a patch on the symptom — it was a probed row, a corrected rule, and a baseline re-frozen so the mistake can never return silently.

REV
DATE
WHAT BROKE
THE FIX
TRACE
A
2026-04
ROUTINGA v1 draft mapped profit centers to verticals naively — and swept an adjacent division's entire special-project revenue, nine figures of it, into the Elevators P&L. Plausible on the label, wrong in the world.
TIME-AWARE RULESRules carry valid_from/valid_to, and a cost-center filter at the lake layer means the engine never even sees a foreign division's rows. Caught in review, before a single sheet shipped.
DOC 14 · CC MAP
B
2026-05
AR JOINThe reference field looked like the perfect AR join key — 98.9% populated. It joined 0.4% of AED. Column population had been conflated with join-rate; the aggregate stat lied.
PROBE, THEN REBUILDv3 rebuilt the chain on the billing document as primary key — 79.6% of AED on the first tier — with accounting-doc and sales-order fallbacks, an 18-rule ladder, and an audit event per fired rule.
DOC 20 · V3 CHANGELOG
C
2026-05
THE EXCEPTIONThe new anti-rule — “never join on that field” — was itself wrong for retentions: clerks routinely key the original invoice into exactly that field on retention and provision rows. Right on average, wrong on the sub-population. Again.
FALSE-POSITIVE-SAFERule R03B fires only when the field matches a known invoice index — customer POs can't match, so they fall through silently. Probe-before-rule became law: no rule without a failed row to motivate it (DETAIL C).
DOC 20 · R03B
D
2026-05
TAXONOMYCopper straddled two verticals; splitting its accountability meant two heads each owning half a number — which is nobody owning it.
ONE OWNER PER NUMBERv4 made copper a single accountability unit; its sub-segments were demoted to drill-only labels, one of them a deliberate “fix-me” bucket that surfaces in the data-quality view. The YTD baseline was re-frozen after the reattribution.
DOC 14 · V4 · 2026-05-14
E
2026-05
PERFORMANCEThe routing engine was too slow for interactive drill — but every fast path risked changing a number nobody would notice until trust was already gone.
GATE FIRST, THEN SPEEDFroze the bucket sums as a regression baseline, then refactored against it: 3.2× faster, output byte-identical to the pre-refactor run. The gate now guards every subsequent refactor.
COMMIT 4E937FC · DOC 18

And the skeptic's question, answered before the interview: this page claims correctness, not speed. No before/after month-end cycle-time was measured — the toil it replaces was never instrumented — so the strongest verifiable outcome here is reconciliation: real SAP totals reproduced to the dirham and frozen as gates. The five-minute figure on sheet 1 is the design target the product is built and accepted against, and it is labeled as exactly that.

VERIFICATION
REGRESSION BASELINE — FROZEN · BYTE-IDENTICAL GATE
RECONCILES — TRIAL BALANCE · AR · INVENTORY
CYCLE-TIME KPI — NOT MEASURED · STATED, NOT HIDDEN
SHEET 6 OF 7 · APPROVAL PLATEPROVENANCE ON EVERY NUMBER

05 · Reconciled to the dirham

0 AEDDrift between engine output and the SAP trial balance — bucket sums frozen as a regression baseline; every refactor gated against itVERIFIED
10Vertical P&Ls drawn where none existed — full ladder, revenue to net profit, an accountability line at CM2aVERIFIED
8733,302Vendor lines expanded to per-vertical AP splits — input net equals output net, exactlyVERIFIED
5,929Source rows classified per period by the 32-rule ladder — deterministic: same rows, same rules, same answerVERIFIED
3.2×Engine speed after refactor — output byte-identical to the pre-refactor baseline, enforced by the gateVERIFIED
5 minAudit-pack CM2 decomposed to named customers, SKUs and vendors — the design target the product is accepted againstCLAIMED
SPECIMEN — MONTHLY MIS PULSE, ONE VERTICAL · SYNTHETIC FACSIMILE, DRAWN TO THE REAL SLIDE GRAMMAR — CLIENT NUMBERS CANNOT BE SHOWN
VERTICAL 07 · PULSE — MONTH AT A GLANCE
REV / GM · 24 MO
01 / 06
P&L LADDER · CM2A = YOUR ACCOUNTABILITY LINE
REV GP CM1 CM2A CM2B NP
02 / 06
CM2A BRIDGE · SUMS EXACTLY, NO “OTHER”
BASEMIXACTUAL
03 / 06
AR AGING · GOV / PRIVATE / RETENTION
0–3031–9091–180180+
04 / 06
DRILL · EVERY LINE — WHICH RULE FIRED, AND WHY
R03B · VIA INVOICE INDEX  ·  R07 · MATERIAL GROUP
05 / 06
DECISION JOURNAL · ENTRY
EXPECTED OUTCOME · CONFIDENCE 70%
SNAPSHOT FROZEN · REVIEW DUE +30 D
06 / 06
EVERY PANE ABOVE IS A STATION FROM FIG. 2 — THE REAL CANVAS RENDERS LIVE OFF THE LAKE FOR THE MONTHLY MIS MEETING · NUMBERS OMITTED BY NDA, GRAMMAR EXACT

What the numbers mean for an operator: your ten vertical heads stop being managers of a blind spot and start being owners of a P&L; your finance team stops hand-cutting SAP dumps and starts adjudicating a reconciliation report; and “why did margin move?” stops being a week of Excel and becomes a question the meeting can answer while it is still the meeting.

Discuss a system like this →
SHEET 7 OF 7 · CLOSE-OUTPLAIN VOICE

06 · What the ledger doesn't prove yet

A dossier this tidy hides the true shape of a live system, so here is the untidy part, plainly.

This machine is in production cutover right now — role-based access, row-level security and SSO are being hardened for a real go-live, with a threat model and a runbook, not a demo switch. The engines and the reconciliation discipline are the proven part. The upper layers are the bet: the diagnosis narratives and drafted actions ship at the lowest autonomy tier and must earn promotion, and the decision journal — the consequence loop this whole page is drawn around — is deliberately ramped over months, because forcing a forecast commitment on someone who has never read a P&L kills the habit in week two.

The hardest engineering wasn't the SQL. It was refusing shortcuts that would have demoed well: refusing to let an LLM near a number, refusing a rule that wasn't motivated by a probed row, refusing to measure a vertical head on costs they don't control. What this build proves is the part I sell — that a raw ERP can be made to confess, deterministically, and that people accept accountability when the line is drawn honestly.

UNRESOLVED
CUTOVER — RBAC · RLS · SSO, IN FLIGHT
DECISION JOURNAL — RAMPED, NOT YET HABIT
CLOSE-TIME KPI — NOT YET MEASURED
REBATE ENGINE — V2 · DRAWN, NOT BUILT
DRAWN & BUILT BY
ABU HURAIRA MUKHTAR · 2026-03 → LIVE
A. H. M.
SHEET 7 OF 7
END OF CASE FILE 004
THE DRAWING OFFICE · AFTER HOURS

The ledger you just read reconciles again tonight.

Bring the number nobody in your business can explain — the margin that moved, the vertical that might be losing money, the report everyone distrusts. The first conversation is a probe, not a pitch: one failed row, examined properly.

Start a conversation → ← Back to the machine room