Skip to Content
-1

How to remove symbol # (Output inbound file from SFTP with WRITE statement)

Hi experts.

I tried to implement ABAP Program outputs inbound file from SFTP server with WRITE statement.

(not uploading file in SAP appl server, just want to output inbound file contents.)

However, symbol '#' was appeared the end of output result like below.

I tried to use REPLACE and CONDENSE statement to remove # , It did not work.

------------------------------------------------------------------------------

abcdefg

hijklmn

opqrstu#######################################

------------------------------------------------------------------------------

In case of uploading file in SAP appl server, this problem is not occurred.

I think this may be due to file format ( need BEGIN ~ END at the begining and end??)

I refer to the following noteļ¼š2007916

https://launchpad.support.sap.com/#/notes/2007916

Thanks.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Nov 01, 2019 at 06:25 AM

    it looks like to be a problem of end-of-line character. What is strange, is you do not have issue with the other lines.

    Before, every time you play with FTP (or SFTP) you should check what kind of system is your source & your destination. If it is different you have to transfert the file in ASCII mode, if it is the same you could transfert in BINARY mode. It will replace all the end-of-line character with the good one (Unix & Windows does not use the same).

    Maybe you could try to check with a tool like Notepad++ what is the character is hexa at the end of your transfered file.

    And you also have in SAP class to help you with this kind of char: CL_ABAP_CHAR_UTILITIES=>CR_LF

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 01, 2019 at 01:26 PM

    # is the standard SAP character which is used to display a non-displayable character, for instance the "CR_LF" character would be displayed as # (cf Frederic answer).

    It may also be due to a bad character encoding conversion (or no conversion at all).

    I suggest that you ask the guys who are knowledgeable about the remote server what contains this file, i.e. its format (are they only characters?) and its character set (AKA code page). After that you may transfer in binary mode and interpret the bytes according to the character set (class cl_abap_conv_in_ce for instance).

    PS: the note 2007916 - Sample Report for https File Transfer from Application Server to Remote Server is not relevant for your issue.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 02, 2019 at 06:48 PM

    you can try one of the below statement

    replace all OCCURRENCES OF cl_abap_char_utilities=>cr_lf in lv_string with space.
    replace all OCCURRENCES OF cl_abap_char_utilities=>newline in lv_string with space.

    Thanks,

    Gourab

    Add a comment
    10|10000 characters needed characters exceeded