Skip to Content

SFTP to SFTP FlatFile PassThru Receiver Adapter encoding Issue

Hi Sdner's,

Scenario: SFTP to SFTP FlatFile PassThru

Input FlatFile Encoding: UCS-2 LE BOM

Expected output FlatFile Encoding: ANSI

I am using MessageTransformbean and TextCodepageConversionBean in receiver SFTP adapter but file is getting altered. NULL spaces and CRLF were added to file.

PFA ouput file generated.

Please advice if any fix/alternate solution ?

PI Version: 7.5 Single Stack, SP-05, Windows installation, Java Ver- 1.8.0_144

output.txt (37.8 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Sep 01, 2017 at 10:58 AM

    Can you please share the source file which is in UCS-2 LE BOM format.

    when I try this it notepad and convert to ANSI I am getting some other characters

    ??1�0�1� �8�8�8�8�8�8�8�8�4� �0�0�0�0�0�0�1�4�5�1�7�0�8�0�7�0�9�0�0�1�0�9�4�1�0�1�D�I�N�E�R�S� �T�R�A�C�S� �F�A�S�T� �E�N�T�R�Y�O�P�E�N�T�E�X�T� �
    �

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 01, 2017 at 11:04 AM

    Hi Raghu,

    PFA...Input file.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Raghu,

      I think because of some legacy system dependency they need target flat file encoding in ANSI.

      Also I've tried below stuff but still no luck :-(

      1. SFTP-->SFTP Pass Thru (not working the ANSI file is getting generated but with null spaces and which is not correct file format)

      • Not working ANSI generating with null spaces and which is not correct file format)

      2. SFTP(FlatToXML)-->Java Map(Converting XML encoding frm UCS-2 LE BOM to ANSI)-->MM(To Sort out the empty lines)-->SFTP(XMLToFlat)

      • Some special chars are appending to beginning of file due to which messages failing @mapping level, I’ve tried handling special chars in MM but still messages are failing at runtime….but when I try executing the payload in MM test tab it is working fine :-(

      Getting below error(This error I am getting after Sender SFTP Adapter converts FlatFile to XML):-

      • BaseRuntimeException: An invalid XML character (Unicode: 0x0) was found in the element content of the document., org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 115; An invalid XML character (Unicode: 0x0) was found in the element content of the document

      3. Flow1= SFTP-->NFS(Pass Thru) & Flow2= NFS-->SFTP(Pass Thru).

      • Not working ANSI generating with null spaces and which is not correct file format)

      My Observations:-

      1. SFTP Sender Adapter is appending special to file chars in Pass Thru/Non-Pass Thru.

      2. SFTP Receiver adapter is adding null spaces to target ANSI file generated in Pass Thru/Non-Pass Thru.

      3. Even I’ve tried doing SFTP-->SFTP Pass Thru without changing any encoding in PI but still file is getting appended with some special chars.

      I feel this is something SFTP Adapter Bug which needs to be raised with SAP ?

  • Sep 24, 2017 at 02:56 PM

    Hi Kiran,

    Try to avoid plan2XML conversion at the sender. Apply UTF-8 encoding on the sender side and do java mapping to arrive at dynamic file name and then covert encoding to ASCII in the receiver.

    Hope it works!

    Ambrish

    Add comment
    10|10000 characters needed characters exceeded