Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

IDOCS

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 12

IDOCS

Idoc's are SAPs file format to exchange data with foreign system. Idocs are ASCII file format to exchange data between computers; the format is chosen arbitrarily Idoc's are similar to segmented files; they are not a description language like ANSI X.12,EDIFACT or XML The Idoc contents are processed by function modules, which can be assigned in customizing. The Idoc process is a straight forward communication scenario. A communication is requested, then data is retrieved, wrapped and sent to the destination in a predefined format and envelope. The information which is exchanged by Idoc is called a message and the Idoc is the physical representation of such a message.

The illustration above displays a sketch for a typical Idoc communication scenario. There is a requesting application , request handler and a target. The sketch shows the communication outbound R/3.Data is leaving the R/3 system. An R/3 application creates data and updates the database appropriately. An application can be a transaction, a stand-alone ABAP Report or any tool that can update a database within R/3.

If the application thinks that data needs to be distributed to a foreign system, it triggers the Idoc mechanism, usually by leaving a descriptive message record in the message table NAST. The application then either directly calls the Idoc engine or a collector job eventually picks up all due Idoc messages and determines what to do with them. If the engine believes that data is ready to be sent to a partner system, then it determines the function module which can collect and wrap the required Idoc data into an Idoc.

In Idoc customizing , you specify the name of the function module to use. This can either be one which is predefined by R/3 standard or a user-written one. When Idoc is created it is stored in an R/3 table and from there it is sent to the foreign system. If the foreign system requires a special conversion , e.g. to XML,EDIFACT or X.12 then this job needs to be done by an external converter, like the SEEBURGER ELKE system. These converters are not part of R/3 systems.

Get a feeling for Idoc's:The first record in an Idoc is a control record describing the content of the data. All but the first record are data records with the same formal record structure. Every record is tagged with the segment type and followed by the segment data. The interpretation of the segment is done by the Idoc application. Both sent and received Idoc's are logged in R/3 tables for further reference and archiving purposes. Idoc's are basically a small number of records in ASCII format ,building a logical entity. It makes sense to see an Idoc as a plain and simple ASCII text file, even if it might be transported via other means. Any Idoc consists of two sections: the control record which is always the first line of the file and provides the administrative information.

the data record

which contains the application dependent data, as in our example below the material master data. We will discus the exchange of the material master IDOC MATMAS in the paragraphs that follow.. The definition of the IDOC structure MATMAS01 is deposited in the data dictionary and can be viewed with WE30.

The IDoc Control Record The very first record of an IDoc package is always a control record. The structure of this control record is the DDic structure EDIDC and describes the contents of the data contained in the package. The control record carries all the administrative information of the IDoc, such as its origin, its destination and a categorical description of the contents and context of the attached IDoc data. This is very much like the envelope or cover sheet that would accompany any paper document sent via postal mail. For R/3 inbound processing, the control record is used by the standard Idoc processing mechanism to determine the method for processing the IDoc. This method is usually a function module but may be a business object as well. The processing method can be fully customized. Once the IDoc data is handed over to a processing function module, you will no longer need the control record information. The function modules are aware of the individual structure of the IDoc type and the meaning of the data. In other words: for every context and syntax of an IDoc, you would write an individual function module or business object (note: a business object is also a function module in R/3) to deal with. The control record has a fixed pre-defined structure, which is defined in the data dictionary as EDIDC and can be viewed with SE11 in the R/3 data dictionary. The header of our example will tell us, that the IDoc has been received from a sender with the name PROCLNT100 and sent to the system with the name DEVCLNT100 . It further tells us that the IDoc is to be interpreted according to the IDoc definition called MATMAS01 .

MATMAS01 ... DEVCLNT100 PROCLNT100 ... Figure 4: Schematic example of an IDoc control record.
The sender's identification PROCLNT100 tells the receiver who sent the IDoc. This serves the purpose of filtering unwanted data and also provides the opportunity to process IDocs differently with respect to the sender. The receiver's identification DEVCLNT100 should be included in the IDoc header to make sure that the data has reached the intended recipient. The name of the IDoc type MATMAS01 is the key information for the Idoc processor. It is used to interpret the data in the IDoc records, which otherwise would be nothing more than a sequence of meaningless characters.

The IDoc Data


All records in the IDocs, which come after the control record are the IDoc data. They are all structured alike, with a segment information part and a data part which is 1000 characters in length, filling the rest of the line. All records of an IDoc are structured the same way, regardless of their actual content. They are records with a fixed length segment info part to the left, which is followed by the segment data, which is always 1000 characters long. We will examine an IDoc of type MATMAS01 . The IDoc type MATMAS01 is used for transferring material master data via ALE. You can view the definition of any IDoc data structure directly within R/3 with transaction WE30. Segment Info Segment Data-! ...E1MARAM ....00000001234567 Material base segment ...E1MARCM ....PL01 Plant Segment ...E1MARDM ....SL01... Storage location data ...E1MARDM ....SL02 -Another storage location ...E1MARCM ....PL02 .Another plant Example of an IDoc with one segment per line, an info tag to the left of each segment and the IDoc data to the right

Interpreting an IDoc Segment Info


Regardless of the used IDoc type, all IDocs are stored in the same database tables EDID4 for release 4.x and EDID3 for release 2.x and 3.x. Both release formats are slightly different with respect to the lengths of some fields. Depending on the R/3 release, the IDoc data records are formatted either according the DDic structure EDID3 or EDID3. The difference between the two structures reflects mainly the changes in the R/3 repository, which allow longer names starting from release 4.x. All IDoc data records are exchanged in a fixed format, regardless of the segment type. The segments true structure is stored in R/3s repository as a DDic structure of the same name. The segment info tells the IDoc processor how the current segment data is structured and should be interpreted. The information, which is usually the only interest, is the name of the segment EDID4SEGNAM. The segment name corresponds to a data dictionary structure with the same name, which has been created automatically when defining the IDoc segment definition with transaction WE31 . For most applications, the remaining information in the segment info can be ignored as being redundant. Some older, non-SAP-compliant partners may require it. E.g. the IDoc segment info will also store the unique segment number for systems, which require numeric segment identification. To have the segment made up for processing in an ABAP, it is usually wise to move the segment data into a structure, which matches the segment definition.

IDocs are SAP's implementation of structured text files Data Is transmitted in ASCII format, i.e. human readable form IDocs exchange messages IDocs are used like classical interface files XML, ANSI X:12 or EDIFACT use a description language. R/3 application creates data IDoc engine picks up the request IDoc engine determines handler function from customizing IDoc is backup up in R/3 and sent out Conversion to standards is done by external program. IDocs are plain ASCII files (resp. a virtual equivalent) Control record plus many data records = 1 IDoc IDocs are defined in WE31.

Control record serves as cover slip for the transport Control record is used by the receiver to determine the processing algorithm Control record not necessary to process the IDoc Data Control Record structure is defined as EDIDC in DDic. All IDoc data record have a segment info part and 1000 characters for data IDoc type definition can be edited with WE30. Data and segment info are stored in EDID4 R/3 is only interested in the segment name Segment name tells the data structure Remaining information is only for foreign systems All inbound and outbound Documents are stored in EDID4 Avoid reinventing the wheel Customizing is done from the central menu WEDI

You might also like