IDoc Part 1: What an IDoc Is — Inbound, Outbound and the Big Picture
Free sample lesson · open to everyone
Understand IDocs: the intermediate document container for ALE/EDI, its control record (EDIDC), data records (EDID4) and status records (EDIDS), outbound and inbound flows, the key configuration objects and the monitoring transactions WE02, WE05, WE19 and BD87.
In this lessonShow sectionsHide sections
Concept visual
Inside an IDoc: control, data and processing status
EDIDC · Control record
Message type, direction, partners and technical routing metadata.
EDID4 · Data segments
Hierarchical business payload, such as header and line-item segments.
EDIDS · Status records
Processing events and error history used for operational diagnosis.
Support workflow
Use WE02 / WE05 to inspect, WE19 to test and BD87 for appropriate reprocessing after identifying and correcting the cause.
Visual overview
The situation: a real project scenario
A customer complained that an order sent by EDI never arrived. The sales team assumed SAP had lost it. In WE02 the inbound IDoc was found with status 51: the customer's material number had no customer-material info record.
After the master data team created the record, the IDoc was reprocessed in BD87 and posted with status 53. The team learned to check IDoc status first before escalating "missing orders".
Explanation
This lesson opens a ten-part series on IDocs, starting with what an IDoc actually is.
The series continues with message type, basic type and extension in Part 2, inbound IDoc processing in Part 3, outbound IDoc, distribution model and reprocessing in Part 4, partner profile, port and RFC configuration in Part 5, inbound process code and function module in Part 6, outbound triggering and output control in Part 7, status codes and reprocessing in Part 8, IDoc extension and custom segments in Part 9, and debugging and production support in Part 10.
An IDoc (Intermediate Document) is SAP's standard container for exchanging business data asynchronously — between SAP systems through ALE, or with external partners through EDI. In EDI, IDocs carry purchase orders (ORDERS), order confirmations (ORDRSP), dispatch advice (DESADV) and invoices (INVOIC) between a company and its customers or suppliers. In ALE between SAP systems, they distribute master data — materials (MATMAS), customers (DEBMAS), vendors (CREMAS) — and post FI documents. Middleware such as SAP PI/PO or CPI often sits in between, converting IDocs to and from other formats.
Every IDoc carries three kinds of records. Every IDoc has one control record (EDIDC: who, what, direction), data records (EDID4: segments with business data) and status records (EDIDS: processing history).
The control record, EDIDC, holds the IDoc number (DOCNUM), its direction (1 for outbound, 2 for inbound), its message type (MESTYP), its basic type (IDOCTP), any extension (CIMTYP), the sender and receiver partner and port, and its current status.
The data records, EDID4, hold the business data itself, organized into segments — E1EDK01 for a header, E1EDP01 for an item, for example — arranged in a hierarchy, with each segment's actual content sitting in its SDATA field.
The status records, EDIDS, record the processing history as a sequence of status numbers with timestamps and messages — 03 for passed to port, 53 for posted successfully, 51 for an error, among others.
The outbound flow, simplified, runs: an application — say, an output type triggered from a sales order — creates the IDoc, which starts in status 30 or 01, it then gets passed to its port, reaching status 03, and from there it travels to the partner system or to middleware.
The inbound flow, simplified, runs the other way: the port receives the IDoc, landing in status 50 or 64, the partner profile determines which process code applies, a function module posts the actual business document, and the IDoc ends in status 53 for success or 51 for an error.
Outbound: an application creates the IDoc and sends it via a port; inbound: SAP receives it and posts it with a function module. Because the whole mechanism is asynchronous, "sent" never means "posted" — IDocs are asynchronous: "sent" does not mean "posted" — always check the status on both sides, since a successful send says nothing about whether the receiving side actually processed it correctly.
A handful of transactions cover day-to-day IDoc work: WE02 and WE05 display IDocs — as a list, by segment, or by status; WE19 is a test tool that lets you copy an existing IDoc and reprocess it; BD87 is the status monitor and reprocessing tool; WE20 covers partner profiles, WE21 covers ports, WE30 and WE31 cover IDoc types and segments, and WE81 and WE82 cover message types.
As an exercise, use WE02 to select IDocs from the last day and open one inbound and one outbound example, look at the control record for the partner and message type, expand the segments, and read through the status records, and then open BD87 to see IDocs grouped by status. By the end you should understand the structure of an IDoc and the basic shape of both the inbound and outbound flows.
Code example
* ===== Reading an IDoc programmatically (display only) =====REPORT zidoc_read. PARAMETERS p_docnum TYPE edi_docnum OBLIGATORY. DATA: ls_control TYPE edidc, lt_data TYPE STANDARD TABLE OF edid4, ls_data TYPE edid4, lt_status TYPE STANDARD TABLE OF edids, ls_status TYPE edids. START-OF-SELECTION.* Control record: who, what, direction SELECT SINGLE * FROM edidc INTO ls_control WHERE docnum = p_docnum. IF sy-subrc <> 0. WRITE: / 'IDoc not found'. RETURN. ENDIF. WRITE: / 'Direction :', ls_control-direct, " 1 = outbound, 2 = inbound / 'Message :', ls_control-mestyp, / 'Basic type :', ls_control-idoctp, / 'Extension :', ls_control-cimtyp, / 'Partner :', ls_control-sndprn, ls_control-rcvprn, / 'Status :', ls_control-status. * Data records: segments with business data (SDATA) SELECT * FROM edid4 INTO TABLE lt_data WHERE docnum = p_docnum ORDER BY segnum. LOOP AT lt_data INTO ls_data. WRITE: / ls_data-segnum, ls_data-segnam, ls_data-hlevel. ENDLOOP. * Status records: processing history SELECT * FROM edids INTO TABLE lt_status WHERE docnum = p_docnum ORDER BY countr. LOOP AT lt_status INTO ls_status. WRITE: / ls_status-status, ls_status-credat, ls_status-cretim, ls_status-statxt. ENDLOOP. * Standard alternative: FM IDOC_READ_COMPLETELY reads all three record typesWatch out
Common mistakes
- Assuming sent means posted.
- Looking only at SAP documents, not at IDoc status.
- Confusing message type and basic type.
- Reading EDID4 SDATA without the segment structure.
- Reprocessing without understanding the error.
Do this
Best practices
- Check control, data and status records together.
- Use WE02/WE05 and BD87 for monitoring.
- Know the message types of your interfaces.
- Correct root causes before reprocessing.
- Document partner and interface setup.
In the interview
Interview angle
Questions: "What is an IDoc?", "What are the record types?", "Difference between ALE and EDI?"
Strong answer: intermediate document for asynchronous exchange; control record EDIDC (direction, message type, basic type, partners, status), data records EDID4 with segments, status records EDIDS; ALE between SAP systems, EDI with external partners; outbound via port, inbound via partner profile/process code/FM; monitor WE02/WE05/BD87, test WE19.
Practice this lesson
Quick check
0 of 3 questions attempted
Question 1 of 3
Which IDoc record holds the processing history with status numbers and messages?
Question 2 of 3
What does IDoc stand for?
Question 3 of 3
Which IDoc record contains sender, receiver, message type and basic type information?
Practise this in an interview
Answer in your own words and get instant feedback, the way an interviewer would judge it.
1What is an IDoc in SAP?
2An inbound ORDERS IDoc failed with status 51. Which parts of the IDoc do you look at first, and why?
Try a related Code Lab
This published exercise covers the same SAP topic. Apply the ideas in a hands-on scenario, then return to review your answers.
Open: Custom Segment Added at Wrong Hierarchy →See it in code
Each example starts from a requirement, shows the design, then the code step by step with a plain-language explanation of every part.
Was this lesson helpful?
Keep exploring
Interview questions on this topic
Related SAP topics
Referenced SAP objects
Reviewed reference pages for the objects this page mentions.
Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.