Data exchange with an SAP system
Before we examine SAP IDoc formats, we must first define the phrase SAP system. When we talk about SAP system in the context of this article, we mean SAP ERP. This system used to be known as SAP R/3 (you may still hear SAP veterans use this term today). Later, the term mySAP ERP became the common nomenclature. Today, the term SAP ERP is common. More recently also its successor SAP S/4HANA.
Other systems, such as SAP Business ByDesign or SAP Business One, play no role in this IDoc contribution – there are other data exchange concepts for these systems.
IDocs are used to import data into and export data from an SAP system. Data refers to business relevant information, which is often exchanged with external business partners using electronic data interchange (EDI). This includes information relating to orders, delivery notes, invoices, material master data etc.
XML vs. Fixed-length format
IDocs can be found in two different forms – either as fixed-length format (especially in older SAP systems) or as an XML-based format. In the following we will only discuss the newer XML-based format.
To get an overview of the IDocs currently configured in SAP, you can use transaction
WE60. SAP uses EDIFACT-like abbreviations to identify IDocs. Anyone familiar with EDIFACT will be quickly able to identify the different types such DESADV, ORDERS, INVOIC, etc. This is not surprising, since the IDoc structure is based on the EDI standards ANSI ASC X12 and EDIFACT.
The following figure shows transaction
WE60 and the example IDoc type
IDoc XML schema
The documentation relevant for electronic data exchange can be found in the corresponding IDoc XML schema and the accompanying documentation. After selecting the IDoc type
DELVRY03, the corresponding XML schema can be displayed using the menu item Documentation > XML Schema. The XML Schema is the basis for the realization of document mappings – e.g. from IDoc to EDIFACT or vice versa.
The following figure shows an overview of the XML schema of the
DELVRY03 IDoc type, using the tree view of Altova XMLSpy. The elements are grouped under a
DELVRY03 root element, which in turn contains a header record
EDI_DC40 and up to 9,999 delivery header items of type
To find out what’s behind the abbreviated names of the XML elements, one has to consult the IDoc documentation. The documentation can also be retrieved using transaction
WE60. After selecting the IDoc type
DELVRY03, the corresponding documentation can be displayed as HTML file by selecting Documentation > HTML Format.
In order to get a complete documentation, the two checkboxes Documentation Output and Field Value Output should be activated in the user settings, as shown in the following illustration. The user settings can be accessed in transaction
WE60 by selecting the menu item Goto > User settings.
The following figure shows the resulting HTML documentation. Using the menu item Documentation > Export one may download the HTML files onto the local hard disk. Other options, such as PDF export, are not available.
Together with the corresponding XML schema, the structure and semantics of an IDoc can now be decrypted relatively easily.
WE19 is also very useful for testing IDocs or finding possible values for a certain field. If the IDoc is not yet available in the SAP system, one may use transaction
CG3Z to manually upload the IDoc.
How do I make my SAP system EDI-ready?
In order to be able to exchange EDI files with other business partners, such as suppliers or customers, a service provider can be used. The service provider takes care of the correct translation of IDocs to the target EDI document formats as well as the correct delivery of EDI documents to the business partners.