Integration & DataGlossary

What Is SAP IDoc (Intermediate Document)?

Also known as: IDoc, Intermediate Document, SAP IDoc EDI, ALE IDoc

Definition

An IDoc (Intermediate Document) is SAP's standard format for exchanging business data such as orders, shipping notices and master data between SAP and other systems, using ALE for system to system links and EDI for partners.

SAP IDoc (Intermediate Document) Explained

An IDoc has three record types: one control record (sender, receiver, message type, basic type), many data records organized in hierarchical segments, and status records that log processing. The basic type defines the structure, for example ORDERS05 for purchase and sales orders, DESADV01 for delivery notes, INVOIC02 for invoices, and MATMAS05 for material master. The message type (ORDERS, DESADV, INVOIC, MATMAS) tells the system how to interpret it.

Outbound IDocs are created by output determination (message control, NAST) or change pointers, then dispatched through a port defined in WE21 according to the partner profile in WE20. Inbound IDocs are received through the port and processed by function modules linked to the message type, which post the business document. The test tool WE19 builds or edits IDocs, and WE02 or WE05 shows them with statuses.

Status codes tell the story: 01 created, 03 passed to port, 30 ready for dispatch, 51 application document not posted (error), 53 application document posted, 64 ready to be passed to the application, 68 no further processing. Failed inbound IDocs with status 51 are reprocessed in BD87 after fixing the cause, such as a missing material or a closed period.

IDocs remain widely used for EDI in manufacturing, including customer purchase orders, ship notices and invoices, usually with a translator or middleware (SAP PI/PO, Integration Suite, or third party EDI) mapping to X12 or EDIFACT. For new interfaces, SAP also provides OData and SOAP services and BAPIs, but IDocs are still the default for high-volume asynchronous exchange.

Why It Matters

  • Most SAP EDI with customers and suppliers still runs through IDocs, so failures show up as lost orders or unposted receipts.
  • Status 51 errors need a business fix, not a technical retry, so monitoring needs to route them to the right owner.
  • IDoc segment fields are the real interface contract, so mapping mistakes are hard to see without reading the segments.
  • Understanding IDocs is required to put an AI or integration layer on SAP without bypassing standard validation.

In Practice

A customer sends an 850 purchase order. The EDI translator maps it to an ORDERS05 IDoc and posts it inbound. A line references a customer material number with no entry in the customer material info record (VD52), so the IDoc ends in status 51. The sales team adds the cross reference, and BD87 reprocesses the IDoc into a sales order without asking the customer to resend.

Frequently Asked Questions

What is the difference between an IDoc and a BAPI?

An IDoc is an asynchronous document container suited to batch and EDI style exchange. A BAPI is a synchronous remote-callable function that returns messages immediately. Both run the same business validations.

How do I reprocess a failed IDoc?

Fix the underlying business cause, then use transaction BD87 or WE19 to process the IDoc again. Status 51 means the application document was not posted.

What are WE20 and WE21?

WE20 is the partner profile that defines which message types are exchanged with each partner. WE21 defines the ports, the technical channels through which IDocs are sent or received.

Working with SAP IDoc (Intermediate Document) in a live environment? Our engineers do this every day - and our AI agents automate most of it.