Content Conversion (Pattern/Random content in input file)

Content Conversion (Pattern/Random content in input file)


Content Conversion (Pattern/Random content in input file)

The scenario deals with the content conversion so as to extract all the data in an input file wherein the content may follow a pattern or content is random.


The Data type is shown as below:


image
Note: During the creation of data type the header, hbatch, body , tbatch and trailer are created at the same level and a recordset creation is ignored.

Here it can be noted that header and trailer have their occurrences as 1 while the hbatch, body and tbatch are 0 to unbounded. In this case the pattern noticed is that the header and trailer comes once and within it hbatch, body and tbatch occur. The body comes repeating in between an hbatch and tbatch. The sample file below will throw more light.

The sample file:


0112345010101

021111112222

03100001111112222

03100011111212223

041000011111

021231116722

03100781119012332

041005611001

059453287699


In the Integration directory, the following has to be mentioned at the configuration of the communication channel.


image image


The recordset name is optional. Even though it is mentioned, it can be ignored by the statement ignoreRecordsetName = true . In the recordset structure, the occurrence for trailer has to be set to ‘ * ‘. The recordsets per message is set to ‘ * ‘. This specifies the number of recordsets to be grouped together in a message. All recordsets are thus included in the XML message.

The output XML thrown to XI for further processing is as shown below:


image

image
Suppose the trailer occurrence is mentioned as 1 (as in the data type created ) then the output XML would not have the complete data as in the input file, rather only the final hbatch, body and tbatch occurring before the trailer would be included in the message.

The output XML after content conversion would be then as follows for the same input file:
image


NOTE: In case, whole of the file follows a random content then all you need to change is the occurrence (make all the nodes as 0 - unbounded) during the creation of data type. At the communication channel configuration, the number of substructures need to be mentioned as * for the sequence.

SAP Developer Network SAP Weblogs: SAP Process Integration (PI)