5 things I learned adding EDI / SAP export to my n8n purchase order workflow [Workflow Included]

:waving_hand: Hey n8n Community,

I recently extended my purchase order extractor I’d built so it can also push orders straight into an ERP (my friend’s company is moving onto SAP). Getting from “data in a Google Sheet” to “file an ERP will actually accept” taught me a few things that weren’t obvious going in. Sharing the five that mattered most.

1. No ERP swallows a raw JSON or PDF. Every real inbound path (SAP IDoc/OData, Oracle’s interfaces, or EDI) expects the same shape: a header plus a lines array. “Directly integrable” really just means your output matches that field set, and EDI 850 is the most universal way in.

2. A valid-looking EDI file can still get rejected. My 850 passed every structural check but carried unit words like “piece” and “roll” straight from the PDF. X12 wants coded units (EA, RL) from its 355 list, so I had to map them, otherwise a strict trading partner bounces the line.

3. Fix messy data at the source, not in code. The POs came with dates in both day-first and month-first formats. Instead of guessing in a Code node, I had the extractor output ISO dates. It has the whole page for context to disambiguate, which a regex never does.

4. Deduplicate on business identity, not the file. I key on the PO number against the Google Sheet I already write to, not the filename or file bytes (a re-scan changes those). Adding each new PO number to an in-memory set as I go also catches the same PO uploaded twice in one batch.

5. Fork one clean object instead of branching a monolith. I build the canonical header + lines object once, then split it: one path flattens to the sheet, the other feeds an optional EDI sub-workflow behind a form toggle. One gotcha worth knowing, in a loop, a skipped duplicate still has to return to the loop node, or the whole thing stalls.

Both workflows (main PO extractor + EDI sub-workflow) and a setup guide are here if you want to pull them apart:

They live alongside 20+ other n8n workflows in my repo – a star helps other builders find them: GitHub - felix-sattler-easybits/n8n-workflows: n8n workflow templates for automated data extraction and document processing. · GitHub

I went with EDI 850 here, but I’m curious what else people are using. Has anyone worked with other formats like cXML, IDoc, or a REST-based import instead? Would love to hear what’s held up well for you and what you’d avoid.

Best,
Felix

إعجاب واحد (1)