SAP IDoc — Intermediate Document
SAP's pivot format. The IDoc is not a transport standard like EDIFACT or X12: it is the internal data container through which SAP sends and receives its business documents. In practice, every EDI integration with a SAP-run company ends up mapping EDIFACT or X12 to — and from — an IDoc.
What is an IDoc?
IDoc stands for Intermediate Document. It is a data structure standardised by SAP to carry a business document (order, invoice, despatch advice, material master…) between a SAP system and another system — whether SAP (via ALE, Application Link Enabling) or external (via an EDI interface).
The key point: the IDoc is independent of the transport and of the target standard. SAP always produces an IDoc; it is a separate component — the EDI subsystem (SAP Integration Suite / PI-PO, or a vendor such as SEEBURGER, Lobster, OpenText…) — that translates this IDoc into EDIFACT, X12 or another format before sending it to the partner, and the other way around on receipt.
The three records
Every IDoc consists of three record types:
| Record | Table | Role |
|---|---|---|
| Control (exactly 1) | EDIDC | Routing metadata: sender/receiver (logical partners), message type, IDoc type, direction (1 = outbound, 2 = inbound), port. |
| Data (n) | EDIDD | The business content, organised into hierarchical segments (E1EDK* header, E1EDP* items…). |
| Status (n) | EDIDS | The processing history: a sequence of timestamped status codes (03 passed to port, 53 posted, 51 error…). |
Anatomy of an IDoc
An outbound ORDERS05 IDoc (purchase order) reads as a control header followed by the nested data segments:
EDI_DC40 |IDoctype=ORDERS05 |Mestype=ORDERS |Direction=1 (outbound)
|Sender=PARTNER_SAP |Receiver=4012345500004 |Port=SUBSYS_EDI
E1EDK01 Header data: currency EUR, order number, Incoterm
E1EDK14 Organisation qualifiers (company code, division)
E1EDKA1 Partner role AG (sold-to) — GLN 5412345000013
E1EDKA1 Partner role LF (supplier) — GLN 4012345500004
E1EDP01 Item 1: quantity 240, unit PCE
E1EDP19 Item object id: GTIN 4006381333931
E1EDP05 Pricing conditions: EUR 2.85
E1EDP01 Item 2: quantity 120, unit PCE
E1EDP19 Item object id: GTIN 4006381333948
Segments start with E1 followed by a mnemonic code: E1EDK01
(header, Kopf), E1EDKA1 (partner), E1EDP01 (item,
Position), E1EDP19 (item identifier). The hierarchy (header → items →
sub-items) is carried by segment levels, much like the segment groups of an EDIFACT message.
Message type vs basic type
Two notions not to confuse:
- Message type — the logical nature of the document:
ORDERS,INVOIC,DESADV,MATMAS. - Basic type / IDoc type — the versioned technical structure:
ORDERS05,INVOIC02,DELVRY03. The numeric suffix is the structure version.
| Message type | Common basic type | Document |
|---|---|---|
| ORDERS | ORDERS05 | Purchase / sales order |
| ORDRSP | ORDERS05 | Order response / confirmation |
| DESADV | DELVRY03 | Despatch advice |
| INVOIC | INVOIC02 | Invoice / credit note |
| MATMAS | MATMAS05 | Material master (master data) |
| DEBMAS / CREMAS | DEBMAS06 / CREMAS04 | Customer / vendor master |
| REMADV | PEXR2002 | Remittance advice |
ALE, ports and partner profiles
IDoc flow is configured by a few key objects, handled via SAP transactions well known to integrators:
- Partner profile (
WE20) — for each partner and message type, the direction, basic type, port and processing mode. - Port (
WE21) — the outbound channel: file (the subsystem reads a directory), tRFC (to another SAP), or XML. - Message control — triggers an IDoc from an application document (e.g. a created order generates an ORDERS05).
- Monitoring (
WE02/WE05) — the IDoc list and their statuses;BD87to reprocess,WE19to test.
Outbound: application document → IDoc → port → EDI subsystem → EDIFACT/X12 → partner. Inbound: partner → EDIFACT/X12 → subsystem → IDoc → a posting function module that creates the document in SAP.
IDoc ↔ EDIFACT / X12
Status codes
The most common statuses (outbound 0x–4x, inbound 5x–7x):
| Status | Direction | Meaning |
|---|---|---|
03 | Outbound | IDoc passed to port (handed to the subsystem). |
12 | Outbound | Dispatch OK (send confirmed). |
30 | Outbound | IDoc ready, awaiting processing. |
02 / 04 | Outbound | Transfer / port error. |
53 | Inbound | Application document posted successfully. |
51 | Inbound | Posting error (business data rejected). |
64 | Inbound | IDoc ready to be posted. |
Further reading
- SAP Help — IDoc Interface / ALE (official documentation).
- The IDoc ↔ EDIFACT/X12 mapping is performed by the EDI suites (SAP Integration Suite, SEEBURGER, Lobster, OpenText, Comarch…).