Académique Documents
Professionnel Documents
Culture Documents
IDOCS
IDOCs
Objective: To understand what is an IDOC. The need for using IDOCs Uses of IDOCs Creating a Custom IDOC Enhancing an existing IDOC Programming Logic for IDOC interface
IDOCs
What is an IDOC ?
The term IDOC stands for Intermediate Document. Its not a process. An IDOC is simply a data container that is used to exchange information between any two processes that can understand the syntax and semantics of the data. An IDOC is created as a result of execution of an outbound ALE or EDI process. In an inbound ALE or EDI process, an IDOC serves as an input to create application document.
IDOCs
IDOCs are independent of sending and receiving system. They can be used for SAP to SAP and SAP to non-SAP process communications as long as the participating processes can understand the syntax and semantics of the data.
IDOCs
IDOCs are independent of the direction of data exchange.An IDOC can be used by an inbound as well as an outbound process. For e.g the ORDERS01 IDOC is used by the purchasing module to send a purchase order and is also used by the sales and distribution module to accept a sales order. This avoids creating redundant IDOC types for the same information.
IDOCs
Asynchronous Document-related
System 1
SAP Document
< EDI subsystem < R/3 System < R/2 System < 3rd party software
SAP application
Document
SAP application
For e.g Standard IDOC MATMAS01 is used to exchange material master information with the legacy system in version 3.1G. Now the company decides to go in for a version upgrade to 3.1H in which MATMAS01 has been enhanced .You can continue to use the older version and then decide to switch to the enhanced IDOC later.
Ability to create and enhance IDOCs Using the standard tools ( IDOC editor and segment editor ) you can either enhance standard SAP IDOCs or create new IDOCs in the system to support custom interface. The newly developed IDOCs integrate seamlessly into the standard ALE/ EDI interface because they are developed using standard tools provided by the system. They also become available in the standard list of SAP IDOCs and can take advantage of all the tools are designed like IDOC monitoring, error handling and archiving.
Following are the benefits of IDOCs over Flat files. Independence from Applications The biggest advantage of using the IDOC interface is that its an open interface i.e independent of the internal structure used by SAP to store data and independent of sending and receiving applications.
Communication with Back-Level IDOCs The standard IDOCs and the segments within the IDOC have a version associated with them.Each time a standard IDOC or a segment is enhanced, the system assigns it a newer version. Partner applications that were developed using a previous version of the IDOCs are fully supported. SAP can generate and process back-level IDOCs. This version management technology offers backward compatibility.
Custom IDOCs are distinguished from SAP IDOCs by their names, as they start with Z. Standard Monitoring Tools Several tools are available to monitor the state of the system. They range from simple IDOC display to IDOC statistics.
IDOC type Documentation Each IDOC in the system is thoroughly documented .The usage is detailed down to the field level with possible values for each field and how it affects the process. The documentation of any IDOC can be obtained using transaction WE60. Archiving Tools Tools are available for miscellaneous tasks such as archiving , data cleanup and restoring information back into SAP.
Use of IDOCs
EDI integration EDI is electronic exchange of business documents between SAP and non-SAP systems.Several applications ( purchasing, sales or shipping ) in SAP are enabled for EDI. To use EDI first the application document viz.. purchase order is created. EDI interface layer converts the application document into an IDOC which is transferred to an EDI subsystem.The EDI subsystem translates the IDOC into an industry-standard format and then transfers it to a business partner over a network.
Use of IDOCs
ALE Integration ALE (Application Link Enabling) enables the exchange of data between two SAP systems.This system allows SAP business processes and applications to be distributed across multiple SAP systems.ALE ensures integration in a distributed SAP environment.
Use of IDOCs
OCR Application integration OCR( Optical Character Recognition ) is a technology that scans and interprets printed matter using pattern recognition. You can integrate an OCR application with SAP via IDOCs. Documents in a standard format can be scanned to generate IDOCs, which then can be transferred to the SAP system for processing. ICR Application integration Bar-code system is an example ICR ( Intelligent Character Recognition ) technology. Data encoded using bar-codes can be captured and stored as an IDOC, which then can be passed to SAP for further processing.
Comparison
The best way to explain the IDOC architecture is to compare your legacy world to how SAP implements the same concept in IDOC lingo.
Lname(10)
Fname(10)
SSN(11)
DOB(8)
Hrly rate(3)
Summary once
Assume that you have an application that records an employees weekly hours .At the end of the month, a file containing the monthly report data for each is sent to external system. This application has been replaced by the SAP system ,and a standard IDOC has been developed to support the process.
Comparison
Following are some properties of the file: It has three types of records: employee header information, weekly details and monthly summaries. Each record type has certain properties ,such as whether its optional or mandatory, number of times it can be repeated, field names, data type for each field, and length of each field. The client site and work description in the weekly details is not always available.
ZMREPT01
Lname
Segments
Fname SSN Dob
Clsite
Work desc.
Comparison
Smith 1 2 3 4
John 30 30 30 50
123-45-6789 102668 40 Houston Brewery 40 Network Computers 50 Network Computers 60 DSP Systems
140
6900
List of permitted segments: These segments make up the IDOC structure. The current example has four segments: Z1EMHDR, Z1WKDET , Z1CLDET and Z1SUMRY. Arrangement of segments: Arrangement specifies the physical sequence and any parentchild relationship in the segments. A parent-child relationship signifies that the child segment cannot exist without the parent and is commonly used for text segments. It gives an IDOC type a hierarchical structure.
Mandatory versus Optional segments: When used in an IDOC type,each segment has an attribute that defines whether the segment is optional or mandatory. In the example given, Z1EMHDR is a mandatory segment because the monthly report will not make sense without the employees basic information.
Minimum / Maximum range for each segment: Each segment has an attribute that defines the minimum and the maximum number of times a data record corresponding to a segment can exist in an IDOC. In the example given, data records corresponding to the Z1WKDET segment can occur multiple times.
SEGMENTS A segment defines the format and structure of a data record. Segments are reusable components, which means they can be used in more than one IDOC type. A segment consists of various fields that represent data in a data record.
Segment Components A segment in the SAP system is technically implemented as three physically separate pieces. Segment type This is version independent name of the segment. SAP provided segment types begin with E1, whereas custom-defined segment types begin with Z1. In the example Z1EMPHDR and Z1WKDET are segment types.
3) Segment Documentation This represents the data dictionary documentation for each field in the segment definition.Segment documentation of SAP-provided segments begins with E3, whereas the segment documentation of customer-defined segment types with Z3. There is only one segment documentation per segment.
Although there are several records in an IDOC, they are still classified as one of the three record type. Control Record Data Record Status Record At run time the following events occur:A unique IDOC number is allocated. One control record is attached to the IDOC. Segments translate into data records. Status records are attached. Syntax rules are checked.
Control Record
IDoc-ID Sender-ID Receiver-ID IDoc type and logical message External structure IDoc-ID Sequence/Hierarchy Segment Format definition for
header data item data
Data Record
Status Record
Data Records In an IDOC, data records contain the application data.The employee header information,weekly details,client details and summary information reside in data records. A data record has two parts: an administrative section and a data section. Administrative section contains the segment name, segment number and hierarchy level. Data section is where the actual data resides. This is mapped to a segment type. Data records are stored in the EDID2 table. The complete documentation of the data record can be viewed by using transaction WE61.
List of status code and there details can be seen by executing transaction WE47.
Extending IDOCS You extend a basic IDOC type when it meets most of your requirements. You have extended the SAP screens to include custom field,such as in the material master and customer master.The master data is to be distributed across several SAP systems using ALE.This situation is a perfect candidate and obvious choice for IDOC extension. Your business partner sends you additional information or expects additional information on an EDI document.This again should be taken as a case of IDOC extension.
Advantages of Extensions
The standard code of processing is still in use. Developments and corrections of standard code are available automatically. Extensions are much less effort than developments.
Extending / Creating an IDOC Creating IDOCS You create a new basic IDOC type when the standard basic IDOC types do not meet your business needs as is or by extending them. You want to synchronize master data between two SAP systems,and this master data s not supported in the standard system. New basic IDOC types are developed especially for interface to legacy systems or third-party products using ALE.Data to be exchanged with Legacy system is usually in a proprietary format and does not map one to one with a standard SAP business process.
Data Analysis
In this stage you analyze data that needs to be exchanged between the two processes.Develop the conceptual picture of the IDOC on a piece of paper. Follow a top-down approach if you are starting a businessdocument level.Break the documents into segments and group the segments that belong together into a segment group.Identify fields in a segment and their data type.Identify any parent-child relationships. Follow a bottom-up approach if you are starting at the field level. You have been given a docment that contain various values that must be exchanged between two segments. Group the fields that are functionally related into segment.Group those segments in a segment group and arrange them in an IDOC type.Identify any parent-child relationship.
A field in SAP is smaller in length than the industry standard ( this occurrence is rare ). Create data elements as already covered in Data workbench section.
Create Segments
Segments are created by using Segment Editor tool.This can be started by executing the transaction WE31. Follow these steps to create a segment: 1) Execute transaction WE31.Enter the name for your segment type ( it must start with Z1 ) and click on create icon. The system prompts you with the name of the development class it uses for the segment. But you can override the default value. 2) Enter the values in the various fields.You are now maintaining the first segment definition.The system automatically assigns a name to the segment definition based on segment type. 3) Save your values and generate the segment definition.Once you save your segment return to the previous screen and enter a description for your segment type.Click on save and you are done.
Create Segments
Create Segments
Changes to basic IDOC type and segments are automatically recorded in a change request.After you transport the objects, you can also manually retransport them from the segment editor and IDOC editor screens by choosing Segment, Transport and Development Object,Transport respectively. Transporting a segment, transports all the segment definitions and documentation, but transporting an IDOC does not automatically transport all the segments. Note:If you release a basic IDOC type without releasing its segments and then, by transporting the basic IDOC type,the segments are not transported.
(d) Save your extension.The system my prompt you for a change request if the changes to Repository Objects option is turned on.