IDoc – Conceptual differentiation
IDocs are a vital tool for the import and export of data to and from an SAP system. The basic idea behind an IDoc was introduced in a previous blog post.
Unfortunately, the term IDoc is not always used consistently. An ABAP programmer may understand something different when referring to an IDoc, than an SAP consultant or EDI project manager for example. In this post we want to define the following five IDoc terms and take a closer look at their specific concepts.
- IDoc Instance
- IDoc File
- Logical Message Type
- IDoc Basic Type
- IDoc Extension Type
In computer science an instance is an occurrence of an object during the runtime of a program. An IDoc instance is of no difference here — it is a concrete occurrence of a document object.
IDocs are stored internally in a persistent manner in the database in SAP, whereby the following tables are filled:
Contains one Control Record per IDoc with one unique IDoc number.
Contains one or more Data Records. The reference to the Control Record is done via the unique IDoc number.
Contains one or more Status Records. The reference to the Control Record is done via the unique IDoc number.
Usually the user will not access the database tables directly but use the appropriate SAP transaction, like BD87. The following image shows IDoc Nr. 1068215 in transaction BD87.
To exchange an IDoc between SAP and an external system, an IDoc instance will be serialised to an export format and written into a physical file. There are two ways to represent the data – ASCII-based IDocs or XML-based IDocs. Modern SAP systems predominantly make use of XML-based IDocs.
The following image shows an XML IDoc of a delivery forecast. This XML IDoc was sent to the SAP system where it was saved as IDoc Nr. 1068215.
The hierarchy of the IDoc as seen in the XML tree is similar to its display in transaction BD87. The following image shows the stored IDoc 1068215 in transaction BD87.
Logical Message Type
The message type describes the type of business document in an SAP system – e.g., an ORDERS IDoc message type is used to describe — as the name already indicates — an order document. A message type can support different use cases. The message type ORDERS for example can be used for an outbound order (sent to a supplier) or an inbound order (received from a customer).
In an IDoc XML, the logical message type can be found in element
<MESTYP>, a sub element of
<EDI_DC40>. This is also depicted in the XML screenshot of the IDoc further up this post.
The logical message type defines which application logic is being applied to the IDoc in the SAP system. Thus, the logical message type provides the connection between the structure of the information and the application logic.
The structure of the logical message type is further described by the IDoc basic type, which we will present in the next section.
IDoc Basic Type
The IDoc basic type provides the structure for the logical message type. The following image shows the structure of IDoc Nr. 1068215 in transaction WE19. In this case the utilized IDoc basic type is DELFOR02.
The IDoc basic type can manifest itself in multiple logical message types. An ORDERS05 basic type is the foundation for an order (ORDERS), an order change (ORDCHG), an order response (ORDRSP), a quote request (REQOTE) etc.
In the XML representation of an IDoc, the basic type can be found in element
<IDOCTYP>, which is a sub element of
To get a list of all basic types and their logical message types, one may start a query via the following three tables.
- EDIMSG (Message types and their assigned IDoc types)
- EDBAS (Basic types)
- EDBAST (Short description of the basic type)
It is possible to use the QuickViewer under transaction SQVI to access these tables.
The two logical message types for the IDoc basic type DELFOR02 are for example DELINS (Delivery Schedule) and DELJIT (Delivery Schedule Just-In-Time).
IDoc Extension Type
An IDoc extension type is an IDoc basic type with one or multiple additional segments. Following the SAP naming convention, IDoc extension types begin with a