SAP IDOC Formats for WDI 3.2 Author: Pete Murphy email@example.com Written: 22nd May, 2003 Version: 0.2 (draft) Update : 18th Feb, 2005 Version : 0.1 (draft) Notes : Include screen shot of latest version of single script and add some comments
Introduction SAP R/3 IDocs are structured business messages. Each SAP R/3 system provides a set of standard IDoc definitions for many of the common business structures such as Sales Orders, Invoices, Material Definitions. If the standard set does not meet an organizations need, they can be customized, extended and sometimes totally new IDocs are created. There are many similarities between EDI documents and SAP R/3 Idocs ; both have the concept of messages, segments , loops and hierarchies. The main differences are (i) each field in a SAP R/3 IDoc is fixed length, and, (ii) all fields are mandatory. Another similarity is that, just as EDI standards have evolved, so IDoc formats have expanded with the different version of SAP R/3. The format of a Sales Order for SAP R/3 3.1H is not the same as a Sales Order for SAP R/3 4.5C. There are several publicly available books that explain the details of SAP IDocs and EDI documents. When SAP R/3 needs to send an IDoc, it can use a variety of mechanisms. Many configurations write the IDoc to a file. The file will start with a header record - EDI_DC40 or EDI_DC, followed by the segments of the IDoc.
The sample above shows a MATMAS IDoc, using message structure MATMAS03 from a SAP 46C system. Each of the IDoc segments are prefixed with a structure that indicates the segment structure (for example E2MARAM004,E2MLANM). Also notice how each line is a different length and is terminated by a new line indicator. For the rest of this document, this type of IDoc will be referred to as a file or EDI IDoc.
SAP R/3 IDocs can also be exchanged with SAP R/3 using ALE and a TRFC. In this case the IDoc content is the same but the segment line length are padded to 1000 bytes. For the rest of this document, this type of IDoc will be referred to as an ALE IDoc
WDI and IDocs The purpose of this document is to show how WebSphere Data Interchange can be used with IDocs, and how the SAP R/3 IDoc formats can be obtained. SAP R/3 provides several ways of describing an IDoc - programmers can obtain C typedefs . A less technical option is the parser report provided by SAP R/3 transaction WE60. The following set of screen shots show how you can navigate an SAP system to obtain this parser report. This was based on a SAP 45A system and unfortunately the screen layouts can change slightly between releases. Firstly you need to invoke transaction WE60 (WE sixty) - Enter WE60 in the transaction box and click on the green circle with the white tick .
The next screen allows you to enter the IDoc - in this case MATMAS03. Select the icon with the Display Tree (It looks like a clock face)
The Display Basic Type shows the IDoc structure and segement definitions. Use the Documentation drop down to get a parser report.
The parser report is a text readable document that shows the structure of the IDoc. Select the List drop down to download the report to an unconverted file.
The next three screen shots show the selection of a directory and the transfer to a pc file.
Once the parser report is downloaded, a quick browse should determine that there are no problems The first line is BEGIN_SEGMENT_SECTION followed by a BEGIN_IDOC line
Using the perl utility you can create 2 types of EIF file - file IDOCS using WDI32_IDOC_TO_EIF.pl - MQLink/ALE IDOCS using WDI32_ALE_TI_EIF.pl
Update Feb 2005 A newer version of the script is available WDI32_IDOC_TO_EIF_PM.pl This includes additional parameters Prefix Field Names : -- allows for very unique field names (usually not required) Key Start :-- primarily for use with IDOCs with very long custom segment names (usually not required) Key Length :- as above Idocs Name :- name used for EIF file . (usually not required) MQLink :- Yes means this is an ALE IDOC and can be used with MQLink No means this is a file IDOC
End Update Feb 2005 The utility script asks for 2 parameters - SAP Version (e.g. 45A, 46C) and IDOC header (EDI_DC40 or EDI_DC) . NOTE (i) Version is used to build structure names, so this must be correct (ii) Currently the only code implemented is for EDI_DC40 (nothing else is valid) The output is an EIF file. Some sample EIF files are provided with this document. They describe the SAP R/3 IDoc in a format that can be imported into WDI 3.2.
The samples cover File/EDI format - MATMAS02 and MATMAS03 for SAP 45A ALE format - MATMAS03 and ORDERS03 for SAP 46C Use the standard import process. The following screen shots show the process used by the WDI 3.2 client.
Update Feb 2005 Import using the latest version of the WDI 3.2.1 Client
End Feb 2005 Update
After the import, check that the data format has been loaded correctly. The IDoc format should match the SAP R/3 parser report layout. The IDoc is loaded as an application format whose Format name is the IDoc type. The following shots show a MATMAS03
How to obtain further IDoc formats As IDoc formats can be customized by site, the samples shipped with this document may not correct. Please attach a copy of the parser report for your IDoc and let me know what SAP R/3 version you are using.