MappingSAP IDocX12Integration

EDI Mapping Explained: From ERP Fields to X12 and EDIFACT Segments

A practical guide to how EDI mapping actually works — the concepts, common source formats, and a worked example translating SAP IDoc fields into an X12 850.

Marcus Webb · EDI Solutions ArchitectPublished 2026-02-14Updated 2026-07-3011 min read
Technical Review by Priya Raman, Senior EDI Integration Engineer
In this article

Every EDI implementation eventually comes down to the same question: how does this field in our internal system become that segment in the EDI file? That's mapping, and while EDI standards define the target structure precisely, they say nothing about your source data — so mapping is where most of the real engineering work lives.

1. What is EDI mapping?

Mapping is the specification of how each field in a source format corresponds to a segment/element in a target EDI format (or vice versa for inbound documents). A mapping spec typically includes the source field, target position, any transformation logic (formatting, unit conversion, code translation), and default/fallback behavior.

2. Common source formats

  • SAP IDocs (ORDERS05, DESADV01, INVOIC02) — SAP's native document format
  • Oracle e-Business Suite / Fusion flat files or open interfaces
  • CSV/Excel exports from smaller ERPs or spreadsheets
  • JSON/XML payloads from modern APIs and microservices
  • Other EDI formats (X12-to-EDIFACT translation for multi-standard supply chains)

3. The mapping process

  1. Obtain the trading partner's EDI implementation guide (their specific rules on top of the base standard).
  2. Document every source field and its data type, format, and possible values.
  3. Build a field-by-field crosswalk: source field → target segment/element, with transformation rules.
  4. Implement the mapping in your translator or integration platform.
  5. Test with representative sample data, including edge cases (missing fields, unusual characters, maximum lengths).
  6. Run a full end-to-end test with the trading partner before go-live.

4. Worked example: SAP IDoc to X12 850

SAP represents a sales order line using the E1EDP01 IDoc segment. Below is how its key fields map onto the X12 850's PO1 loop.

EDI Mapping Visualizer

Pick a source and target format to see how fields translate.

Source · SAP

E1EDP01-MATNR
E1EDP01-MENGE
E1EDP01-NETPR
E1EDT10-NTANF
E1EDK01-BELNR

Target · X12

PO108 (Product/Service ID)
PO102 (Quantity Ordered)
PO104 (Unit Price)
DTM*002 (Requested Delivery Date)
BEG03 (Purchase Order Number)

Business fields represented: Item / Material · Quantity · Unit Price · Delivery Date · Order Reference. Hover a row to trace it across formats.

5. Handling qualifiers and code lists

EDI standards rely heavily on qualifier codes — PO107 tells you whether PO108 is a vendor part number, buyer part number, or UPC. Your source system rarely stores this distinction explicitly, so mapping logic usually needs a small rules table: 'if the item master has a vendor part number populated, use qualifier VP; otherwise fall back to the internal SKU with qualifier BP.'

Document your qualifier decisions

Keep a living reference table of every qualifier choice made per trading partner. When a new team member picks up support six months later, this table is what prevents them from re-litigating decisions that were already agreed upon.

6. Testing your mapping

  • Unit test individual field transformations (date formatting, unit-of-measure conversion) in isolation.
  • Run full sample transactions through the translator and diff the output against the partner's implementation guide examples.
  • Test boundary conditions: zero quantities, very long descriptions, special characters that could collide with EDI delimiters.
  • Validate the output with the partner's own test/certification environment before going live.

7. Common pitfalls

PitfallWhy it happensHow to avoid it
Delimiter collisionA free-text field (like an item description) contains the EDI segment or element separator characterEscape or strip reserved delimiter characters during mapping
Silent truncationTarget element has a shorter max length than the source fieldValidate field lengths at mapping time, not just at runtime failure
Hardcoded qualifiersMapping assumes only one qualifier will ever be usedBuild qualifier selection as configurable logic, not a hardcoded constant

Frequently asked questions

Not strictly, but purpose-built translators (IBM Sterling, Cleo, Boomi, MuleSoft) handle envelope construction, segment validation, and partner-specific rules that are painful to build from scratch.

Have a follow-up question about this topic?

Ask EDI AI →