IDocs (Interface Documents) are modeled as UML classes (cf. TXTRAW01). Such classes can be serialized into SAP IDoc tables (arrays) by the <<SAPIDocRecordComposer>>. 

There are two situations in which you may want to compose an IDoc data buffer:

Figure: UML Class Model of IDoc TXTRAW01

Composing to String: <<SAPIDocComposer>>

The <<SAPIDocComposer> takes one ore more IDoc objects as input and composes a String containing the object data. The structure of the data is kept (padding).

The following examples are demonstrating some applications of the <<SAPIDocComposer>>.

Composing a Single IDoc to an IDoc String

Figure: SAPIDocParser, Single IDoc to a String

Composing Multiple IDocs to an IDoc String

Figure: SAPIDocComposer, Multiple IDocs to a String

Composing to SAP Tables: <<SAPIDocRecordComposer>>

The <<SAPIDocRecordComposer> takes one ore more IDoc objects as input and composes an array of structured control records and an array of structured data records (as expected for SAP tables).

Composing a Single IDoc to SAP Tables

Figure: IDoc Composer with a IDoc-array to Tables

Composing Multiple IDocs to SAP Tables

Figure: IDoc Composer with a IDoc-array to string

Composing to XML: <<SAPXMLIDocComposer>>

The <<SAPXMLIDocComposer> takes one ore more IDoc objects as input and composes a Blob containing the object data. The structure of the data is kept (padding).

The following example is demonstrating an application of the <<SAPXMLIDocComposer>>.

Composing Multiple IDocs to an XML Blob

Figure: SAPIDocParser, Multiple IDocs to XML


IDoc Composition and SAP R/3

The above examples show how to compose IDocs version of 4.x. However, SAP R/3 3.x systems use IDocs, too. These IDocs are handled similar as in version 4.x. The differences between composing version 4 and version 3 IDocs are as follows :