IDoc (intermediate document)
IDoc (intermediate document) is a standard data structure used in SAP applications to transfer data to and from SAP system applications and external systems. Using IDocs, companies with SAP ERP systems, for example, can exchange data with external entities like their partners or customers.
The transfer between SAP systems is done through SAP's Application Link Enabling (ALE) system, while the transfer from an SAP system to an external system happens through electronic data interchange (EDI). This allows data to be exchanged between the different systems without having to convert data from one format to another.
IDocs are used for asynchronous transactions: Each IDoc generated exists as a self-contained text file that can then be transmitted to the requesting workstation without connecting to the central database. By comparison, another SAP mechanism, the Business Application Programming Interface (BAPI), is used for synchronous transactions.
An SAP IDoc consists of three parts:
- Control Record contains administrative information such as the IDoc type, message type, current status, sender and receiver.
- Data Record contains all the IDoc data, which is stored in groups called segments. Each IDoc may contain standard segments and custom segments.
- Status Record provides information about the various stages the IDoc has passed through.
Types of IDocs
IDocs can be triggered in the SAP system or in the EDI subsystem. An IDoc coming into an SAP system is called an Inbound IDoc, while an IDoc going out of a system is called an Outbound IDoc. An Outbound IDoc is triggered through document message control to the EDI subsystem. EDI then converts the IDoc data into XML or an equivalent format and sends the data to the outside system via the internet. For Inbound IDocs, EDI converts the outside system data and the IDoc is created in SAP. An application document is then posted in the SAP system after it processes the IDoc.
IDoc types define different categories of data, such as purchase orders or invoices, which may then be broken down into more specific categories called message types. Greater specificity means that an IDoc type is capable of storing only the data required for a particular transaction, which increases efficiency and decreases resource demands.
How IDoc is used in SAP
An IDoc can be generated at any point in a transaction process. For example, during a shipping transaction process, an IDoc may be generated that includes the data fields required to print a shipping manifest.
After a user performs an SAP transaction, one or more IDocs are generated in the sending database and passed to the ALE communication layer. The communication layer performs a Remote Function Call (RFC), using the port definition and RFC destination specified by the customer model. The IDoc is transmitted to the receiver, which may be an S/4HANA, R/3, or other external system.