CASE STUDY · ENTERPRISE ERP AUTOMATION & IDP

Zero-Touch PDF & Excel Order Intake Pipeline for Enterprise ERP Systems

Comarch ERP XL / Subiekt GT B2B Wholesale Distribution €10M+ (45M+ PLN) ARR 1,500 Orders / mo Fractional AI Architect: Patryk Klesta 2026
Executive Summary (Answer-First): Architected and deployed a sovereign, Zero-Touch Intelligent Document Processing (IDP) ingestion pipeline integrated with Comarch ERP XL and Subiekt GT for a major B2B technical distributor (€10M+ annual revenue, 1,500 wholesale orders monthly). The system collapsed average order registration time from 14 minutes to 45 seconds (-94.6%), reclaiming 315 operational hours monthly for the customer operations team, while slashing SKU/EAN and price-tier error rates from 4.8% to 0.1%. Exactly 88% of wholesale orders flow directly into the production ERP transactional buffer with zero human keystrokes.
45 s
Average Order Entry Time (was 14 min)
315 h
Operations Staff Hours Saved / mo
0.1%
EAN & Pricing Error Rate (was 4.8%)
88%
100% Zero-Touch Automation Rate

1. The Baseline Bottleneck & Operational Reality

The enterprise is a national B2B wholesale distributor of industrial hardware and engineering components, processing 1,500 purchase orders monthly across an inventory catalog of 14,000 SKUs. A dedicated four-person Customer Operations team spent their working hours manually transcribing data from customer emails into the enterprise ERP suite (Comarch ERP XL and Subiekt GT).

Wholesale contractors and industrial buyers submitted purchase orders in dozens of non-standard formats: digital vector PDFs, multi-tab Excel workbooks (XLS/XLSX), scanned invoices with physical stamps, and raw table exports. Registering a single document required:

  • Manually decoding buyer descriptions and cross-referencing buyer internal codes with internal master EAN indices,
  • Validating contract pricing, volume tier discounts, and customer-specific price lists tied to tax identification numbers,
  • Querying real-time credit limits and open accounts-receivable balances in the ERP accounting ledger,
  • Manually re-typing line items line-by-line into the native ERP Sales Order entry form.

Average cycle time was 14 minutes per order. The team spent 350 staff hours every month purely re-keying data. Operator fatigue triggered errors in 4.8% of all orders (mistyped EAN digits, confusion between single units and master cartons, or mismatched discount formulas). These discrepancies led to costly credit-note adjustments, delayed warehouse pick-and-pack operations, stalled cash collection, and friction with Tier-1 accounts. Total latency from email receipt to warehouse fulfillment averaged 28 hours, burning 38,500 PLN (€8,900) monthly in repetitive labor overhead.

2. System Architecture & Engineering Layers

I engineered and deployed a containerized, sovereign intake pipeline built on Python 3.12, Pydantic v2 schemas, and an isolated PostgreSQL staging buffer to prevent direct, unvalidated writes to the core ERP database:

graph TD
  subgraph Ingestion["1. Ingestion & Pre-processing"]
    A[B2B Inbound Mailboxes / Wholesalers] -->|IMAP Webhook / n8n Core| B[PDF & Excel Attachment Extraction]
    B --> C[Azure Document Intelligence / Table OCR]
  end

  subgraph Extraction["2. Deterministic LLM Extraction & Validation"]
    C --> D[Python 3.12 Extraction Engine]
    D -->|Structured JSON| E[Pydantic v2 Schema Validator]
    E -->|Schema Mismatch| F[Langfuse Telemetry & Auto-Retry]
  end

  subgraph Staging["3. SQL Staging Buffer & Business Rules"]
    E -->|Validated JSON| G[(PostgreSQL Staging Buffer)]
    G --> H[Business Rule Engine]
    H --> I[Customer SKU to EAN Cross-Mapping]
    H --> J[Tier Pricing & Contract Matrix Verification]
    H --> K[Credit Limit & Balance Check]
  end

  subgraph Decision["4. HITL Decision Gate"]
    H --> L{Validation Condition?}
    L -->|Price Delta >2% OR Limit Exceeded| M[Exception Queue: Slack Alert + Operations Dashboard]
    L -->|100% Match - 88% Volume| N[Comarch ERP XL API / Subiekt GT API]
  end

  subgraph Execution["5. Transactional ERP Execution"]
    N --> O[(ERP Production DB: Sales Order ZS)]
    O --> P[WMS Picking Queue: Instant Warehouse Dispatch]
    M -->|1-Click Account Manager Authorization| N
  end
        

Architectural Layer Breakdown:

  • Layer 1: Ingestion & Pre-processing: Inbound B2B mailboxes are monitored via self-hosted n8n orchestrator webhooks. Inbound attachments trigger SHA-256 cryptographic hashing for instant deduplication, followed by Azure Document Intelligence extraction to resolve complex spatial grid coordinates and multi-line invoice tables.
  • Layer 2: Deterministic Extraction with Pydantic v2: Python 3.12 microservices process the extracted layout using language models constrained by strict JSON schema enforcement. Order headers (tax ID, PO number, delivery window, target shipping address) and line items (buyer part number, product description, ordered quantity, unit of measure, net price) are deterministically parsed. Any typing mismatch triggers Langfuse telemetry logging and an automated retry loop.
  • Layer 3: SQL Staging Buffer (PostgreSQL) & Business Rules Engine: To safeguard production ERP integrity, extracted datasets land in an isolated PostgreSQL staging buffer. The engine runs:
    • Fuzzy association matching buyer part numbers against historical master EAN catalogs with a 98% confidence threshold,
    • Real-time price recalculation against customer-specific contract discount matrices stored in the ERP database,
    • Automated credit solvency checks against open receivables and trade credit limits.
  • Layer 4: Decision Gate & Human-in-the-Loop Routing: Clean orders without discrepancies automatically pass straight into the production ERP pipeline (Zero-Touch). Orders displaying price variance exceeding 2%, unmapped buyer SKUs, or credit limit flags are routed to an exception queue, triggering a Slack alert with a 1-click mobile authorization dashboard.
  • Layer 5: Transactional ERP Execution (Comarch ERP XL / Subiekt GT API): Approved records are committed via official ERP transactional APIs. The system registers official Sales Order (ZS) documents, secures inventory reservations, and pushes picking tasks to warehouse terminals in real time.

3. Performance & Business Impact (KPI Table)

Performance Metric (KPI) Pre-Deployment (Manual) Post-Deployment (Zero-Touch) Measured Delta
Average Order Entry Time 14 minutes 45 seconds -94.6% (18x acceleration)
Operations Hours Spent Re-Keying 350 h / month 35 h / month -315 h / mo (2 FTEs liberated)
SKU & Pricing Error Rate 4.8% of orders 0.1% of orders -97.9% (near-total elimination)
Email-to-Warehouse Fulfillment Time 28 hours 4 hours -85.7% (same-day dispatch)
Monthly Process Cost 38,500 PLN (€8,900) 5,400 PLN (€1,250) -86.0% (saving €7,650/mo)
Zero-Touch Automation Rate 0% (fully manual) 88% autonomous +88 percentage points autonomy

4. Autonomy Boundaries: The Human-in-the-Loop Safeguard

To guarantee complete data integrity and prevent AI hallucinations, the pipeline maintains strict operational boundaries between automated execution and human oversight:

100% Autonomous AI Pipeline Tasks:

  • Parsing multi-page tables across complex PDFs and spreadsheets while retaining column hierarchies,
  • Extracting buyer corporate entity details via VAT/tax ID and pulling live ERP customer master records,
  • Mapping buyer internal part numbers to internal master EAN indices via association matrices,
  • Mathematical recalculation of line net sums, applicable VAT rates, gross totals, and tier volume discounts,
  • Automated creation and status commitment of Sales Order documents for 88% of inbound traffic.

Tasks Requiring Human Authorization (12% Exception Volume):

  • Discrepancies exceeding 2% between quoted buyer pricing and master contract ERP matrices,
  • Insolvency risk flags: credit limit breaches or overdue invoice settlements,
  • Novel inventory part numbers lacking prior mapping in the cross-reference registry,
  • Handwritten or unstructured contract addendums requiring legal or commercial sign-off.

5. Deep Dive: High-Stakes Edge Case

Scenario: Low-Resolution Scan with Handwritten Discount Annotation

A customer emailed a 150 DPI scanned purchase order tilted by 7 degrees, featuring a handwritten note scrawled along the margin: "5% discount as agreed directly with the Sales Director".

System Response: The Document Intelligence layout engine separated typed machine text from handwriting strokes. The extraction model identified the semantic meaning of the annotation and flagged the entry with unauthorized_discount_annotation=True. Rather than blindly applying the discount or ignoring customer intent, the pipeline blocked automated ERP entry, held the record in the PostgreSQL buffer, and generated a real-time Slack notification for the assigned account manager featuring a cropped, high-resolution image of the handwritten note. With a single mobile tap, the manager authorized the discount, instantly updating the audit log and dispatching the order to Comarch ERP XL.

6. Technology Stack & Data Sovereignty

Python 3.12 FastAPI Pydantic v2 PostgreSQL 16 (Staging Buffer) n8n (Self-Hosted Docker) Azure Document Intelligence Comarch ERP XL API / Subiekt GT Sfera Langfuse Telemetry Slack Webhooks Docker Compose

The entire pipeline runs on dedicated, sovereign server infrastructure owned by the client. Sensitive commercial pricing, customer catalogs, and trade terms are never shared with public multi-tenant SaaS clouds. The enterprise maintains 100% code and database ownership with zero per-document licensing fees and zero vendor lock-in.

7. Executive Testimonial

“Transitioning from manual order re-keying to a deterministic Zero-Touch pipeline with a PostgreSQL staging buffer transformed our cash flow. Instead of four specialists trapped entering data into Comarch ERP XL, our operations team actively services clients, while 88% of wholesale orders reach the warehouse floor in 45 seconds from email intake. Re-keying errors have practically ceased to exist.”

— CFO, B2B Distribution Enterprise (€10M+ Annual Revenue)

Looking to eliminate manual data entry in your ERP workflow?

Schedule a 30-minute technical briefing with Patryk Klesta. We will analyze your document flows, assess your ERP integration points, and calculate your exact return on investment (ROI).

Schedule 30-Min Engineering Briefing →