How to force CR/LF on file adapter
SAP PI File adapter allows us to write files on a remote server through file system or FTP/SFTP protocols. PI seamlessly manages different operating systems and uses the default end-of-line character that is:
– CRLF for Windows systems;
– LF for Unix systems.
Anyway, we should be in need of producing a file with a specific end-of-line character, for example CRLF on Unix systems. This is a quite easy goal for SAP PI, you need just a couple of parameters on the Receiver File communication channel:
– open Integration Directory and edit your receiver CC;
– under the “Processing” tab you must specify “File type = Text”;
– you can also specify “File encoding = UTF-8” if you need it, but it’s non mandatory;
– under che “Content conversion” tab you must specify a property on each of your record types. The property you must set is endSeparator.
This property allows you to force a specific character (or characters) at the end of each line. The value of this property is one or more characters specified using their ASCII code; each code must be in the format 0x$$ where $$ is the hexadecimal value of the character, and must be between single quotes without any space.
As you can see on the ASCII table, the character “CR” (carriadge return) corresponds to the value 13 and the “LF” (line feed) corresponds to the value 10. Converting these numbers on hexadecimal format, and respecting the syntax explained below, we obtain the endSeparator property value:
‘0x0D”0x0A’
Save and activate your CC, and you’re done!
Hello Matteo,
What if the receiver channel is SFTP and not file. How can we achieve carriage return line feed in the generated file?
Thanks,
Rohit Sinha
Hi Rohit,
Did you get this sorted? We are facing the same challenge to have output file with CRLF, since the target SFTP Server supports only that.
Thanks,
ANuj
I got this sorted here...
https://answers.sap.com/questions/12985919/sap-cpi-sftp-receiver-channel-error-linuxunixmac-o.html