IDoc Structure: Technical Background

IDocs are archived in three database tables in SAP - one for the control record, one for the data records, and one for the status records.

  • The control record is identical for all IDocs and contains the administration information, for example, sender, recipient and message. Note that the control record also contains the last processing status ( STATUS field).
  • The data records contain the segments and administration information for the segments (for example, a parent segment to which it is attached).
  • The status records contain all of the previous processing statuses, as well as the corresponding administration information. This information is not sent between systems as part of the IDoc but rather as a separate data packet.

Viewed externally (that is, as they are sent to the subsystem), the IDocs are located in three structures which correspond to the three database tables: The control records, data records and status records are also used there. A description of the individual fields can be accessed using the documentation tools in the system.

The figure below shows the basic structure of the IDocs in the SAP System (IDoc Interface viewed externally, that is, the "external structures") with some sample fields.

The parent-child structure of the segments is realized by the PSGNUM field, which contains the number of the parent segment (if applicable). In addition, the HLEVEL field also contains the hierarchy level. The actual application data, that is, the actual segment, is located in the SDATA field. This field, in turn, is subdivided into individual application fields. The maximum length of SDATA is 1000 bytes.

The SEGNUM field in the status record is used to identify segments which have caused syntax errors. SEGFLD fulfills the same function at the lowest level of the segment fields.

A segment is defined as a required segment in the IDoc type, but was not filled when the actual IDoc was generated. For this reason, the relevant IDoc does not contain this required segment - the syntax check returns an error; the missing segment is marked in the SEGNUM field.