Services‎ > ‎Implementing EDI‎ > ‎

What is an SAP IDoc?

An IDoc Type is SAP's format for data being moved between applications. Essentially, SAP has defined what a sales order, financial statement, invoice, etc will look like electronically. This includes how fields are grouped together (segments), the order and hierarchy of these groupings, and the format of each individual field.

If you're familiar with EDI at all, then an IDoc will look very familiar to you. Nearly everything you're used to is there: from segment name to allowable codes to min/max occurs.

It is important to note that an IDoc Type is really just a structure defined on the system and given a name (i.e., ORDERS04). An actual IDoc, however, consists of data, which fits within the defined structure of the IDoc Type. This IDoc is identified by a number rather than by a type.

IDoc Structure

The "only once" rule

It is valuable to note that SAP only allows one occurence of each segment type within the IDoc structure. For instance, the E1EDKA1 segment may only exist once within the IDoc type.
Now, does that mean you can only have one E1EDKA1 segment in an actual IDoc? Of course not. Segments may occur multiple times if the "max occurs" setting for that segment is greater than one. This is how the E1EDKA1 segment can appear multiple times in the ORDERS04 IDoc.
This isn't a big deal if you're just using canned IDocs from SAP; but it is a useful consideration if you need to extend an existing IDoc substantially or create your own.

Generic Structure

Data within an IDoc is divided into three sections
  1. Control Record, which contains (Table EDIDC)
    1. Key Fields (for inbound)
      1. Receiving Partner Type/ID (RCVPRT, RCVPRN)
      2. Logical Message Type
      3. Test Flag
    2. Other Fields
      1. IDoc Number (DOCNUM)
      2. Direction (1=Outbound; 2=Inbound)
      3. Sending Partner Type/ID (SNDPRT, SNDPRN)
      4. Status
      5. Receiver/Sender Port
      6. Created Timestamp
      7. Changed Timestamp
    3. etc.
  2. Data Records (Table EDID4 in 4.6C)
    1. Admin Data (39 bytes)
      1. IDoc Number (DOCNUM)
      2. Segment Number
      3. Segment Name (SEGNAM) (e.g., E1EDK01, E1EDK03, etc)
      4. etc
    2. Actual Data (SDATA – 1,000 bytes)
  3. Status Records (Table: EDIDS)
    1. IDoc Number (DOCNUM)
    2. Counter (COUNTR)
    3. Status (STATUS)
    4. etc

Additional Considerations

  1. Data record table is version-specific. EDID4 is valid for the current release of SAP R/3 and may change in future versions.
  2. The control record is common across all transactions and is used for routing the IDoc to the correct port in external processing, or to the correction function module or workflow item for inbound processing.
  3. Each IDoc may have several data records, which are arranged hierarchically. The data segment table (EDID4) contains this nesting information in the hierarchy field, etc.
  4. Each IDoc may have several status records, which are arranged in sequence.
  5. Segment Types begin with E1. This is the internal SAP format.
  6. Segment Definitions begin with E2. This is a fixed, version-specific format which defines how the outside world sees the segment.
  7. Segment Documentation records begin with E3.
  8. Outbound IDocs are created directly by a function module, or may be created via message control. Most outbound documents within OTC are created by message control.
  9. The global IDoc Administrator is defined in transaction OYEA.

Status Codes

Outbound Codes
Inbound Codes
00
Not used, only R/2
50
IDoc added
01
IDoc created
51
Error: Application document not posted
02
Error passing data to port
52
Application document not fully posted
03
Data passed to port OK
53
Application document posted
04
Error within control information of EDI subsystem
54
Error during formal application check
05
Error during translation
55
Formal application check OK
06
Translation OK
56
IDoc with errors added
07
Error during syntax check
57
Test IDoc: Error during application check
08
Syntax check OK
58
IDoc-Copy from an R/2 connection
09
Error during interchange handling
59
Not used
10
Interchange handling OK
60
Error during syntax check of IDoc (inbound)
11
Error during dispatch
61
Processing despite syntax error (inbound)
12
Dispatch OK
62
IDoc passed to application
13
Retransmission OK
63
Error passing IDoc to application
14
Interchange Acknowledgement positive
64
IDoc ready to be transferred to application
15
Interchange Acknowledgement negative
65
Error in ALE service
16
Functional Acknowledgement positive
66
IDoc is waiting for predecessor IDoc (serialization)
17
Functional Acknowledgement negative
67
Not used
18
Triggering EDI subsystem OK
68
Error - no further processing
19
Data transfer for test OK
69
IDoc was edited
20
Error triggering EDI subsystem
70
Original of an IDoc which was edited
21
Error passing data for test
71
IDoc reloaded from archive
22
Dispatch OK, acknowledgement still due
72
Not used, only R/2
23
Error during retransmission
73
IDoc archived
24
Control information of EDI subsystem OK
74
IDoc was created by test transaction
25
Processing despite syntax error (outbound)
26
Error during syntax check of IDoc (outbound)
27
Error in dispatch level (ALE service)
28
Not used
29
Error in ALE service
30
IDoc ready for dispatch (ALE service)
31
Error - no further processing
32
IDoc was edited
33
Original of an IDoc which was edited
34
Error in control record of IDoc
35
IDoc reloaded from archive
36
Electronic signature not performed (timeout)
37
IDoc added incorrectly
38
IDoc archived
39
IDoc is in the receiving system (ALE service)
40
Application document not created in receiving system
41
Application document created in receiving system
42
IDoc was created by test transaction
Comments