Now accepting guest editorial from SAP, Oracle, Workday and ServiceNow practitioners.Pitch a guide
The Sign-Off Table

Lesson 3 of 6

Mapping outbound IDocs to EDI

8 min

Listen to this lesson

0:00 / 8:35

An outbound EDI flow has the same shape for every partner: receive the IDoc, find the partner, map the IDoc to the EDI structure in XML, convert the XML to EDI text, and deliver it. The mapping in the middle is where the business meaning lives, and where most defects hide.

Contoso's outbound pattern: identify the partner, map to the EDI XML structure, convert to X12 text, deliver.
The Sign-Off Table · thesignofftable.com/academy/sap-pim-205

Schemas for the EDI side

The mapping's target is an XML representation of the EDI message, described by an XSD. The XML to EDI Converter then turns that XML into X12 or EDIFACT text, checked against the schemas you add to the flow (or name in a header). SAP accepts XSDs from Integration Advisor, named like ASC-X12_850_004010.xsd or UN-EDIFACT_ORDERS_D96A.xsd, or the XSDs from SAP Process Integration/Process Orchestration; SAP notes that from EDI to XML Converter version 2.6 the same X12 XSDs as in PI/PO can be used. Take the schema version from the partner's implementation guide. Contoso uses X12 004010 with Lakeside and Great Lakes.

ORDERS05 to X12 850

ORDERS05X12 850Rule
E1EDK01-BELNRBEG03 purchase order number4500002210
E1EDK03 (document date)BEG05 dateyyyyMMdd stays CCYYMMDD
E1EDK01-BSART order type (FixValues)BEG01 / BEG0200 original; NB → SA stand-alone order
E1EDKA1 with PARVW WEN1 loop with N101 = STcreateIf on PARVW = WE (sap-pim-201)
E1EDP01 per itemPO1 loopOne PO1 per item; check the queue
E1EDP01-MENGE / MENEEPO102 quantity / PO103 unitUnit through value mapping PCE → EA
E1EDP01-VPREIPO104 unit price42.00, with a real decimal point
E1EDP19 with QUALF 002PO106 = VP, PO107 = supplier part numberSupplier's material number for CMC-RTR-200
Count of E1EDP01CTT01 number of line itemscount in the right context

The core of Contoso's ORDERS05-to-850 mapping for PO 4500002210: 500 rotors at 42.00 = 21,000.00 USD. Check every row against Lakeside's implementation guide.

Qualifiers drive most of the mapping logic. An IDoc carries several E1EDKA1 partner segments distinguished by PARVW, and several E1EDP19 object segments distinguished by QUALF (001 the customer's material number, 002 the supplier's). On the X12 side, N1 loops are distinguished by N101 and product IDs by their qualifier, such as VP for the vendor's part number or BP for the buyer's. Every qualifier pair is a condition in the mapping: ifWithoutElse or createIf with equalsS, and the source context set so all segments of the item are tested.

INVOIC02 to X12 810

Contoso's customer invoices to Great Lakes Fleet Services are INVOIC02 IDocs created from billing. Invoice 90001877 bills sales order 1000457 and delivery 80001234: 50 × CMC-ALT-100 at 240.00 = 12,000.00 USD, tax-exempt. In the 810, BIG01 is the invoice date, BIG02 the invoice number, BIG03 the PO date and BIG04 the customer's PO number, which must echo the PO number from the customer's 850 exactly. Each item becomes an IT1 with quantity, unit and unit price.

The total is the classic trap. TDS01 carries the total invoice amount with two implied decimal places, so 12,000.00 is sent as 1200000, while IT104 carries the unit price with a real decimal point, 240.00. Build TDS01 from the IDoc's total (multiply by 100, then format without decimals) and test it with amounts that have cents, because a whole-dollar test can hide a misplaced decimal.

  1. Invoice 90001877INVOIC02: 50 PCE × 240.00, total 12,000.00 USD, no tax
  2. BIGBIG02 = 90001877, BIG04 = Great Lakes' PO number from their 850
  3. IT1IT102 = 50, IT103 = EA (value mapping), IT104 = 240.00
  4. TDSTDS01 = 1200000 (two implied decimals)
  5. EnvelopeISA/GS/ST with control numbers; SE, GE and IEA counts
Invoice 90001877 as an X12 810: the same amount appears with a real decimal in IT104 and with implied decimals in TDS01.
The Sign-Off Table · thesignofftable.com/academy/sap-pim-205

EDIFACT: the same ideas, different names

For partners that use UN/EDIFACT, the structures change but the method doesn't. An ORDERS message starts with BGM (document name code 220 for an order), uses DTM for dates, NAD with qualifiers such as BY, SU and DP for parties, and a LIN group per item with QTY and PRI. An INVOIC uses document name code 380 for a commercial invoice and MOA segments for amounts. Contoso has no EDIFACT partner today; the planned Mexican acquisition may bring some, so the team keeps one EDIFACT sample in its regression pack design.

Envelopes and control numbers

Every X12 interchange needs unique control numbers in ISA13 and the group and transaction set headers. Cloud Integration provides Number Range objects for exactly this (Monitor, Manage Stores, Number Ranges): a minimum, maximum, current value, field length with zero padding, and an option to rotate back to the minimum. Set the field length to 9 for ISA13. SAP points to a blog for consuming number ranges in EDI processing; whichever way you consume them, test that two messages never get the same number and that the counts in SE, GE and IEA match what the converter produces.

Key points
  • Pattern: identify the partner, map to EDI XML, XML to EDI Converter, deliver.
  • Use Integration Advisor or PI/PO XSDs named as SAP requires; take the version from the partner's guide.
  • Qualifiers (PARVW, QUALF, N101, product ID qualifiers) are conditions in the mapping.
  • TDS01 has two implied decimals: 12,000.00 → 1200000. Use Number Range objects for unique control numbers.

Check your understanding · not graded

Lesson check

  1. 1. How is invoice 90001877's total of 12,000.00 USD sent in X12 TDS01?

  2. 2. Which IDoc segment and qualifier supply the supplier's part number for PO107 with PO106 = VP?

  3. 3. Which file name fits SAP's naming rule for an Integration Advisor X12 810 schema?

  4. 4. What does outbound IDoc status 03 prove?