cancel
Showing results for 
Search instead for 
Did you mean: 

Handling Flat file in SAP PI 7.3 dual stack

ramu_g4
Participant
0 Kudos

Hi Experts,

We are working on requirement where the input flat text file contains "#$" characters which needs to be replaced by "Enter" key i.e., next line. Please find the snippets of both input & output files as shown in 1st & 2nd snippets. You can see output/expected file look like in 2nd snippet.

1st snippet:

2nd snippet:

Please suggest me the ways to transform the input file as shown in 1st snippet to expected file as shown in 2nd snippet.

Thanks,

Ramu G.

Accepted Solutions (0)

Answers (7)

Answers (7)

ramu_g4
Participant
0 Kudos

i Experts,

When I use parameter <RecordSetStructure>.additionalLastFields = ignore in sender channel then only first field is picked up as shown in below snippet as per runtime payload:

where my requirement is to generate the file with below structure or anything to separate the by '#$' as separator , here runtime payload contains "Recordset" field which appeared auto.

Thanks,

Ramu.

ramu_g4
Participant
0 Kudos

Hi Anoop, Experts,

As explained above my requirement is file to file where the input text file contains '#$' which needs to be replaced by '/n' or 'nl'. I did following configuration on FCC sender & receiver channel where the input file will be a text file. Please find below snippets:

Data type : [same structure for both sender & receiver]

FCC Sender channel config:

FCC receiver channel config:

In runtime I am getting an error:

Kindly help.

Thanks,

Ramu.

ramu_g4
Participant
0 Kudos

Hi Anoop,

You mean I can achieve this just by FCC? If we use FCC in sender channel then it would convert flat text file to XML right ? In that case then again I should use FCC in receiver channel to convert from XML to flat file structure. Where exactly should I replace these characters with new line character? How to achieve this using pass-through scenario as you suggested.

Thanks,

Ramu.

former_member207703
Active Participant
0 Kudos

Hi Ramu,

You are correct and you have to use FCC for both File Sender and Receiver Adapters. As i already specified in my previous message that you have to replace "#$" with "/n" and to do so you have to use FCC in both ends.
In File Sender CC use fieldSeparator as "#$". And yes it convert yout text file in XML.

After that in File Receiver CC, use fieldSeparator as "/n". And it will create your file as text again with new lines. But keep your fieldNames in Sender CC and Recordset Structure in Receiver CC same.

I told you, it's may be just like a bypass scenario, because i hope you don't require any MM. If require, then just make a one field mapping i.e., fieldNames that you specified in Sender CC. But i didn't try it by myself without mapping for that, give me time till tommorow, i will try it and update it. But with MM it definately work, as i done many scenarios like that. If you observe something, then please share it.

Regards,

Anoop Kumar Rai

former_member207703
Active Participant
0 Kudos

Hi ,

Use File Content Conversion in File Sender Channel and replace "#$" with "/n". Its as simple as this.

Even, if its flat file to file, with this change only, then i hope you can also try for bypass scenario.

Thanks and regards,

Anoop Kumar Rai

ramu_g4
Participant
0 Kudos

Hi Evgeniy,

It is a file transfer but "#$" characters need to be replaced with "Next line" [/n] in that file But can we do Java mapping to parse the file and replace the characters accordingly.

Thanks,

Ramu.

ramu_g4
Participant
0 Kudos

Hi Evgeniy,

Thanks for your response,the scenario is simple like NFS to SFTP where the input and output files are text files but as explained above just we need to replace "#$" set of characters in the input file with "Next line"[/n] i.e., Enter key in keyboard. Except this change both the files are identical. Kindly help me with Java mapping to achieve this requirement. Would it be possible with graphical mapping by any chance?

Thanks,

Ramu.

former_member190293
Active Contributor
0 Kudos

Hi Ramu!

Do you use any mapping in this scenario? You say, that it's a simple file transfer.

Regards, Evgeniy.

ramu_g4
Participant
0 Kudos

Hi Experts,

Can you please help me with Java mapping to achieve this requirement.

Thanks,

Ramu G.

former_member190293
Active Contributor
0 Kudos

Hi Ramu!

You can use custom adapter module in sender channel for replacing that sequense. Or you can use java mapping to do the same.

It depends on your scenario type. Is it pass-through scenario or you perform file content conversion and use XML structure in further message flow?

Regards, Evgeniy.