There are two situations in which you may want to parse an IDoc data buffer:
Both parsers generate an output class of type Array having an IDoc UML class as its array element type, e.g. TXTRAW01.
Figure: UML class model of the IDoc TXTRAW01
After having called the parser, you can catch parsing errors as described in Catching Errors.
The <<SAPIDocParser> takes an IDocString as input and assumes that it contains valid control and data records. This string is parsed to a class that must correspond to the contained IDoc.
The <<SAPIDocParser>> can be used with the following parameters:
The <<SAPIDocParser>> returns an Any object having the stereotype <<SAPIDoc>>.
The following examples are demonstrating some applications of the <<SAPIDocParser>>.
If you are sure, that the parser input contains only one IDoc, you can get the output directly into an output object of the corresponding IDoc type (e.g. TXTRAW01).
Figure: SAPIDocParser, Single IDoc From String
Explanation of the activity diagram:
After having called the parser, you can catch parsing errors as described in Catching Errors.
If the parser input contains multiple IDocs (of the same type), you should get the output in to an array of objects of the corresponding IDoc type (e.g. TXTRAW01).
Figure: SAPIDocParser, IDoc From SAP Tables
Explanation of the activity diagram:
After having called the parser, you can catch parsing errors as described in Catching Errors.
The <<SAPIDocRecordParser> takes two structured arrays as input and assumes that they contains valid control resp. data records. These arrays are parsed to a class that must correspond to the contained IDoc.
The <<SAPIDocRecordParser>> can be used with the following parameters:
You can get the input arrays from given SAP tables, an object of type Tables, e.g. using a transformation as depicted in the following example:
Figure: Getting IDoc Control and Data Records from Given SAP Tables
The <<SAPIDocRecordParser>> returns an Any object having the stereotype <<SAPIDoc>>.
The following examples are demonstrating some applications of the <<SAPIDocRecordParser>>.
If you are sure, that the parser input contains only one IDoc, you can get the output directly into an output object of the corresponding IDoc type (e.g. TXTRAW01).
Figure: SAPIDocRecordParser, Single IDoc From Tables
Explanation of the activity diagram:
If the parser input contains multiple IDocs (of the same type), you should get the output in to an array of objects of the corresponding IDoc type (e.g. TXTRAW01).
Figure: SAPIDocRecordParser, Multiple IDocs From Tables
Explanation of the activity diagram:
You can inspect the parsing process of the SAP IDoc Record Parser with the Analyzer. To view the parser trace file do the following:
Select Show adapter input/output > OUTPUT from the context menu. The adapter output will be displayed in the Watches section of the Analyzer.
Right-click the displayed adapter output output and select Copy Value from the context menu.
Paste the copied content into a text editor of your choice. It displays something like:
Start parsing message: recreate_internal_structure..._965161528|_17_0_3_b2002db_1406276778049_987802_26054. Start adding IDoc. Adding IDOC number: 14468604. Start adjusting CREDAT Type: target type = String. CREDAT: DateTime converted to String: 20140526. |
The <<SAPXMLIDocParser> takes a Blob as input and assumes that it contains valid control and data records. This string is parsed to a class that must correspond to the contained IDoc.
The <<SAPXMLIDocParser>> can be used with the following parameters:
The <<SAPXMLIDocParser>> returns an Any object having stereotype <<SAPIDoc>>.
The following example is demonstrating an application of the <<SAPXMLIDocParser>>.
If you are sure, that the parser input contains only one IDoc, you can get the output directly into an output object of the corresponding IDoc type (e.g. TXTRAW01).
If the parser input contains multiple IDocs (of the same type), you should get the output in to an array of objects of the corresponding IDoc type.
Figure: SAPXMLIDocParser, Multiple IDocs From XML
Explanation of the activity diagram:
The above examples show how to parse IDocs of version 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 parsing version 4 and version 3 IDocs are as follows :