Skip to Content
0

Handling Flat file in SAP PI 7.3 dual stack

Nov 17, 2016 at 12:00 PM

93

avatar image

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.

1stsnippet.jpg (36.2 kB)
2ndsnippet.jpg (66.8 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

7 Answers

Ramu G Nov 17, 2016 at 01:21 PM
0

Hi Experts,

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

Thanks,

Ramu G.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

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.

0
Ramu G Nov 18, 2016 at 06:13 AM
0

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.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Ramu!

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

Regards, Evgeniy.

0
Ramu G Nov 18, 2016 at 08:20 AM
0

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.

Share
10 |10000 characters needed characters left characters exceeded
Anoop Rai Nov 18, 2016 at 08:57 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded
Ramu G Nov 18, 2016 at 09:31 AM
0

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.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

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

0
Ramu G Nov 23, 2016 at 11:42 AM
0

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.


datatype.jpg (47.5 kB)
sender-channel.jpg (90.2 kB)
error.jpg (19.7 kB)
Share
10 |10000 characters needed characters left characters exceeded
Ramu G Nov 23, 2016 at 01:02 PM
0

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.


Share
10 |10000 characters needed characters left characters exceeded