The most simple IDoc is TXTRAW01 containing as data part just a string. The IDoc header contains information like segment type, segment number, parent number, and so forth. The parent number is used to link the segment to other segments building a hierarchical structure. The data part consists of values put in position dependent slots. The information which data attribute is found on which position can be found in the IDoc parse grammar (WE60 - choose IDoc type - click on Parser (F9)) on your SAP system. More information about IDocs can be found in the SAP Library help.
The result of importing TXTRAW01 together with the description of the SAP parser grammar to UML mapping is shown in the class diagram TXTRAW (see figure "Example Of an Imported TXTRAW IDoc").
The modeler must execute the following steps in order to get UML classes of a SAP IDoc:
- Generate the parse grammar.
- Generate a WSDL file from the generated SAP IDoc parse grammar.
- Import the generated WSDL into the UML model.
You can find more information of how to execute this step on Importing SAP IDoc Meta Data the E2E Builder User's Guide.
- Model and compile the IDoc transformations.
You can find more information of how to execute this step on IDoc Handling.
Structure of the Imported Classes
The result of importing SAP IDoc parse grammars will be a set of classes being of stereotype <<SAPIDoc>>. Such classes must be derived from the EDI_DC40 class which holds all attributes found in the control record because the control record is common to all IDocs (see figure "Example Of an Imported TXTRAW IDoc").
Each segment is modeled as class of stereotype <<SAPIDocSegment>> that has an association to the IDoc class or to other segments. The association end name and multiplicity is given by the segment name respectivly the LOOPMIN/LOOPMAX numbers in the SAP parse grammar.
An example of a SAP IDoc parse grammar is:
SAP IDoc segment classes have the following tagged values:
|hierarchyLevel||corresponds to |
|type||corresponds to |
|group||Segments containing child segments (see class diagram of |
Segment attributes can have the following tagged values:
|order||gives the order of the attribute within the IDoc; corresponds to FIELD_POS in the SAP parse grammar|
|offset||index position in bytes starting at the beginning of the segment; corresponds to BYTE_FIRST in the SAP parse grammar|
|externalLength||reserved length of the field in the IDoc segment: BYTE_LAST - BYTE_FIRST|
|internalLength||length in the SAP system: corresponds to LENGTH in the parse grammar|
|nativeType||basic data type of the segment attribute. The supported types are listed beneath|
|decimals||number of decimals. Relevant only for numeric types such as DEC|
Figure: Example Of an Imported TXTRAW IDoc
Generating and Importing Meta-information
The base grammar does not contain simple type information – every data element is of type String. Therefore, if it is required to use other base types (such as e.g. numbers, because you want to do some calculations), it is necessary to import additional meta-information of the simple types of the data segment attributes. Without this information it is not possible to convert IDoc segment attribute types automatically to internal types.
This information is typically found in the HTML descriptions of IDocs. The HTML documentation can also be generated within transaction WE60. The generated HTML documentation is then used as input of the IDoc Importer, which maps the segment attribute types to internal types.
The mapping is as follows:
|Input Type||Output Type|
Figure: Fragmentary View of CREMAS01 IDoc Class Structure