Create CSV with Text Enclosure in Receiver

 Want to create an CSV with Quote as an enclosure in SAP PI receiver adapter? Easy way to do

 Adapter Engine, Receiver Communication Channel, File Adapter

  SAP Integration    |      Anupam Chakraborty    |      Jan 19 2015 11:00 AM

 Login to Like      Login to Follow      161 Views

Problem?

Your requirement is to a CSV file with Double Quotes between each field. This is to make sure that if a value field has the separator inside the text, the reader, does not consider that as a separator. Let us take an example.

ID,NAME,ADDRESS,CITY,ZIP
1,Rob,167, Wall Street,New York,11122
2,Michelle,127 6th Ave,New York,11123

This would have created something like

IDNameAddressCityZip 
1Rob127Wall StreetNew York11122
2Michelle 6th Ave12New York11123 

However, if we have had this as: 

ID,NAME,ADDRESS,CITY,ZIP
"1","Rob","167, Wall Street","New York","11122"
"2","Michelle","127 6th Ave","New York","11123"

It would have turned out correctly.

 

Solution

In this case, the simplest solution, someone would think would be to change the map and add two DoubleQuote (") to each fields. But we would see a simpler solution using FCC here.

File Content Conversion:

Use the following FCC parameters. Make sure that you do not put any space in between the characters.

record.fieldSeparator="," DoubleQuote ActualSeparator DoubleQuote
record.endSeparator="nl DoubleQuote NewLine
record.beginSeparator=" A Single DoubleQuote

This would make sure that the data looks as required:

"1","Rob","167, Wall Street","New York","11122"
"2","Michelle","127 6th Ave","New York","11123"


Comments:

Leave a Comment:

Please login to post comment into this page.

Please login to submit a new Blog.