File Content Conversion for Unequal Number of Columns

File Content Conversion for Unequal Number of Columns

Now consider this scenario, the input flat file is in the following format.
  • Books, CD, Video, Games
  • CD, Games, DVD
  • DVD, CD, Video, Games, Books
  • Books
  • CD, DVD

The input file has different number of column fields in every row. In the first row it has 4, then, 3 then 5, then 1 and finally it has 2.

We have to convert this, as an output file in which every item should be placed in the corresponding itemset. The output file has the following format.

Books

CD

Video

Games

CD

Games

DVD

DVD

CD

Video

Games

Books

Books

CD

DVD

Here is the structure of the Input data type and the Output data type in the Design part.

Input Data type

image

Output Data type

image

Create the corresponding Message Types and Message Interfaces.

Now we will see the Message mapping.

Message Mapping

image

In the mapping to do this conversion we need a user-defined function.

User-Defined Function




Finally create the Interface Mapping also.

In the Configuration part, both the Sender and Receiver Communication channels will use File adapter.

In the Sender Communication channel, we have to choose the Message Protocol as File Content Conversion and also fill the Content Conversion Parameters as shown in the following picture.

image

And also add the following columns in the Content Conversion Parameters. These columns are sufficient to do this conversion.

image

Then do the remaining Confiuration part for executing this scenario.



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