About IDoc

IDoc (Intermediate Document)

IDoc is an acronym for Intermediate Document. It 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 (Customers, Suppliers, Logistic Providers etc.).

The transfer from SAP to non-SAP system is done via EDI subsystems whereas for transfer between two SAP systems, ALE is used.

 

General use 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 in SAP to the EDI subsystem. The EDI subsystem then converts the IDoc data into ANSI X.12, EDIFACT or an equivalent format and sends the data to the outside system via the internet. For Inbound IDocs, the EDI subsystem 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.

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.

You can view an IDoc in SAP using transaction WE02 or WE05.

 

IDoc structure

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:

1) Control Record
- Contains administrative information such as the IDoc type, message type, current status, sender and receiver etc.
- All control record data is stored in SAP table EDIDC. The key to this table is the IDoc Number
- Direction '1' indicates outbound, '2' indicates inbound

2) Data Record
- Contains application data, which is stored in groups called segments. Each IDoc may contain standard segments and custom (Z-) segments
- All data record data is stored in SAP tables EDID2 to EDID4 and EDIDD is a structure where you can see its components
- It contains data like the IDoc number, name and number of the segment in the IDoc, the hierarchy and the data
- The actual data is stored as a string in a field called SDATA, which is a 1,000 characters field

3) Status Record
- Status record is attached to an IDoc at every milestone or when errors are encountered
- All status record data is stored in SAP table EDIDS
- Statuses 1-42 are for outbound while 50-75 for inbound IDocs are valid

 

Message Type

IDoc processing involves transmission or receipt of electronic business documents in a form of a message and each message represents a document in SAP. These documents can be an Order, an Advanced Shipping Notification or an Invoice.  The Message Type is always linked to the Basic Type and defines the kind of data or document that is exchanged with the partner.

 

Basic Type/IDoc Type

The Basic Type (or IDoc Type) defines the structure of an IDoc. Each Basic Type describes the standard IDoc segments, the format of the data fields and their size. The Basic Type also defines the number of segments and fields in an IDoc. All the fields that are necessary for the transmission of a message for a particular business transaction are populated respectively mapped in different segments. The Basic Type also defines the structure and relationship of IDoc segments along with mandatory and optional segments.

Basic Types are based on the EDI standards, mostly based on EDIFACT.

 

IDoc Extension

The Basic Type contains all the standard fields that are necessary for carrying out a business transaction. However, if any additional values have to be sent to a partner then this can be achieved by creating an IDoc Extension. IDoc extension is an enhancement of a Basic Type and contains additional custom IDoc segments and fields that are not available in the standard Basic Type.

 

IDoc Segment

IDoc segments contain the actual data that is sent to or received from a partner.

 

Message Control

Message Control is a mechanism in which you can trigger the outputs based on a certain condition. There can be different forms of output like Workflow, print output, IDoc or even fax. This is normally configured for the transactional data. Message control is also referred as Output control.

 

Partner and Partner Type

A Partner is the Business Partner exchanging information with us. It can be a vendor or customer or any other (ERP-)System. Depending on the direction of information in which the information is sent, it can be either a “sending partner” or a “receiving partner”.

The Partner Type or Role is used to identify partners within the SAP System. For example Partner Type "KU" is for customers, "LI" for vendors and "LS" for a Logical System.

 

Partner Profile

The Partner profile must be maintained for all the business partners to whom we want to send or receive IDocs.

A Partner profile contains parameters for Inbound and Outbound processing of IDocs. For each message type we can maintain inbound/outbound options, message control, post processing options and contact information.

The Transcation Code for maintaining the Partner Profile is WE20.

 

Port

The Port contains the information about the way data is sent between the source and/or target system. The type of a Port defines the information contained within the Port. For the Port type “Internet” the Port will contain the IP Address of the target system. For the Port type “file”, directory or file name information is maintained. A “tRFC” Port contains information about the RFC destination of the target system. For IDoc transmission using ALE “tRFC” Ports are normally used.

The Transcation Code for maintaining the Port is WE21.