cancel
Showing results for 
Search instead for 
Did you mean: 

.CSV to .txt using SFTP Adapter

vishnu_pallamreddy
Contributor
0 Kudos

Hi All,

I have requirement where I need to pick .csv file and convert it as .txt file using SFTP.

The below are the validations.

1.       Must be a pipe separated, .txt file

2.       Must have !##! At the end of every line in .txt file.

3.       Must be encoded via UTF-8 format.

4.       Need to avoid the first line from CSV i.e. function owner and department.


I am attaching source .csv file and expected target  .txt file.



Could you please help me on the requirement.



Accepted Solutions (1)

Accepted Solutions (1)

engswee
Active Contributor
0 Kudos

Hi Vishnu

You can achieve this by performing content conversion using MessageTransformBean in both sender and receiver channel. Refer to the following wiki for sample configurations.

How To...Content conversion module with J2EE JMS adapter - Process Integration - SCN Wiki

For item 3, PI by default handle content in UTF-8 format.

For item 4, you can skip the first line by filtering it out in a mapping. Refer to my answer in the following thread.

Rgds

Eng Swee

vishnu_pallamreddy
Contributor
0 Kudos

Hi Yeoh,

i need to use SFTP Adapter.

So can I use Message Transform Bean as Plain2XML in sender and XML2Plain as in receiver?

Must have !##! At the end of every line in .txt file.


So for above validation i need to use end separator as !##! right? or '!##!'?

in receiver .txt file i need Header name as ORG_ID|STUD_ID!##! for that what I have to do?


engswee
Active Contributor
0 Kudos

Hi Vishnu

Please check the wiki properly for the correct conversion type, you should use the following:-

SimplePlain2XML - sender

SimpleXML2Plain - receiver

To fulfill the end of line requirement, you need the following parameter (need extra 'nl' at the end to have the line break)

ParameterValue
xml.endSeparator!##!'nl'

As for the header line, you can configure the following

ParameterHeader 2
xml.addHeaderLine3
xml.headerLineORG_ID,STUD_ID

You can refer to the following if you want to understand further

Converting XML in the Receiver File/FTP Adapter to Text Format - Advanced Adapter Engine - SAP Libra...

Rgds

Eng Swee

Answers (0)