File Content Conversion In Sap Pi At Receiver

Posted on  by 



Skip to end of metadataGo to start of metadata

  1. What Is Sap Pi 7.0
  2. Sap Pi Jobs
  3. Sap Pi Sheet

R.O

(XML -Flat File) Using Adapter Module – Receiver. In help.sap.com related to File Content Conversion. Is stored in the NFS file system of SAP PI. This is a basic overview of content conversion using the file adapter. Categories SAP PI/PO Leave a comment Post navigation Sender IDocAAE Adapter Configuration in SAP PI/PO File Content Conversion with simple structure (Fixed Length File) in Sender File Adapter.

Introduction

This is intended for all those who are familiar with the basics of “SAP PI” and File/FTP adapter. In receiver channel, File Content Conversion not only helps in converting the file formats from XML which records in the same layer, but also the hierarchical ones.

In this article one can understand how to use FCC parameter in receiver adapter to handling hierarchical structure. And we can use it to get some complex format in output file.

Sample Scenario with Multiple Layers of data:

Let us consider a case in which the target structure is shown below.


Figure1:Hierarchical structure in target side

And the required file format is shown below.

HField1 HField2 HField3 | IField1 IField2 ‘nl

| IField1 IField2 ‘nl’

| IField1 IField2 ‘nl’

| …... ‘nl’

HField1 HField2 HField3 | IField1 IField2 ‘nl’

| IField1 IField2 ‘nl’

| …... ‘nl’

1.1 Test1 for FCC parameter

Test1 used to test how some separators work in FCC for Hierarchical Structure.


Figure2:Test data for test1

Content Conversion Parameter:

Recordset Structure: Header, Item

Header.fieldSeparator : ++++

Header.endSeparator : <HeaderEnd>

Item.beginSeparator : |

Item.fieldSeparator :

Item.endSeparator : <@ItemEnd>n
Figure3:Result for test1

From this result we can get 3 points:

  1. The last field of Head and the first field of Item is separated by the Item.fieldSeparator ()
  2. The first record of Item doesn’t contain beginSeparator.
  3. Header.endSeparator doesn’t work in this structure.

Note: ’nl’ only works in the endSeparator, but n can work in everywhere.

1.2 Test2 for FCC parameter

Since we know how these separators work, we can modify the configuration to get the format we want. Now in order to align the Headers and Items, we should use fieldFixedLengths.

What Is Sap Pi 7.0

According to the result of test1, I changed the value of HField3.


Figure4:Test data for test2

Content Conversion Parameter:

Recordset Stucture: Header, Item

Sap Pi Jobs

Header.fieldSeparator : (2spaces)

Header.fieldFixedLengths : 7,7,10

Item.fieldFixedLengths : ?????????

Item.beginSeparator : (spaces) | (2spaces)

Item.fieldSeparator : (2spaces)

Sap Pi Sheet

Item.endSeparator : n

The illustration below shows two simple testing of the parameter configuration fieldFixedLengths, and explains how the fieldFixedLengths works in this hierarchical structure.

1. How many parameter should be specified in fieldFixedLengths:

Item.fieldFixedLengths: 7,7

Error: more fields found in XML structure than specified in conversion parameters! (Value 'IField1')', probably configuration error in file adapter (XML parser error)'

Resolution: as the error description, we need to add one more field to test again.

Item.fieldFixedLengths: 7,7,7

Error: more fields found in XML structure than specified in conversion parameters! (Value 'IField1')', probably configuration error in file adapter (XML parser error)'

Resolution: as the error description, we need to add one more field to test again.

Item.fieldFixedLengths: 7,7,7,7

Sheet

Error: more fields found in XML structure than specified in conversion parameters! (Value 'IField2')', probably configuration error in file adapter (XML parser error)'

Resolution: as the error description, we need to add one more field to test again.

Item.fieldFixedLengths: 7,7,7,7,7

Successful.

Result Format:

HField1 HField2 HField3 | IField1 IField2

| IField1 IField2

HField1 HField2 HField3 | IField1 IField2

| IField1 IField2

| IField1 IField2

| IField1 IField2

*Note: Here we can see the number of fields we specified in fieldFixedLengths (5) should be equals the number of fields in Header(3) plus the number of fields in Item(2). Although with specifying the extra Header fields in Item.fieldFixedLengths, it will not affect the configuration of Header segment.


2. How to specified the length of fields:

Item.fieldFixedLengths: 6,6,6,7,7

Error: Column value 'IField1' too long (>6 for 0. column) - must stop', probably configuration error in file adapter (XML parser error)'

Resolution: As there has three fields has the length of 6, we should modified to test the first field’s length to 7 and make it same with IField1.

Conversion

Item.fieldFixedLengths: 7,6,6,7,7

Error: Column value 'IField2' too long (>6 for 0. column) - must stop', probably configuration error in file adapter (XML parser error)'

Resolution: As there has three fields has the length of 6, we should modified to test the first field’s length to 7 and make it same with IField2.

Item.fieldFixedLengths: 7,7,6,7,7

Successful

*Note: As the HField1 and HField2 have the same length with the IField1 and IField2,so it would not pops up error and the third field in Header segment will not affect the fields in Item segment when configuration.

Item.fieldFixedLengths: 10,10,10,7,7

Successful

*Conclusion: Here we specified the length of 10, which is used to find out where will the added spaces placed.

Result format and principle:


Figure 5: Result format and principle

*Note: The result above shows principle of the fieldFixedLengths when configure the hierarchical structure.

It seems that casually appearance for this sample of hierarchical structure to use FCC. It’s not recommended to use fieldFixedLengths in this structure directly. fieldFixedLengths can only used when in Item fields less or equals the Header fields.

Conclusion

Sometimes we should use hierarchical structure to handle the scenario in which includes multiply Headers and each Header contains multiply Items. And FCC can help us generate the format what we want.

Reference(s)

www.help.sap.com

XI - File Content Conversion

By Punit J, YASH PI Competency Team, Yash Technologies

Description: File Content Conversion is used to convert non-XML file (flat file) to XML file and vice-versa. In this blog, we will see how to convert flat file to XML file when file structure is bit complex. For example, when same columns shows different information in different rows.

Business Case: Let’s take an example with file shown below. The file contains employee details. First row contains Header information of Employee (Employee ID and Name), Second and Third row contains his weekly details (Week No, Working Hours in the Week and Wage for the Week), there can be n number of rows for weekly details and Last row contains Employee Monthly Summary (Total hours worked and Total Wage).

Screen shot

Find below the step-by-step procedure to achieve this scenario:

Development on Integration Repository side.

1.Create Data Type.

Here I have added a filed Key in all the records, we will discuss about this field while configuring Sender File Adapter.

2. Create Message Type.

3) Create Message Interface for Sender and Receiver. In this scenario I am using same Message Type for both Sender and Receiver as we are converting flat file to XML file.

4) Create Message Mapping.

Here we don’t have to map the field ‘Key’.

5. Create Interface Mapping.





Coments are closed