Hi,
I am using function module FTP_CONNECT to transter a file to a unix server. I can get the file to the server but when you view the file in unix it contains ^M. The unix program cannot load because of this.
Can anyone help me to get rid of ^M.
Here is the code:
slen = strlen( pwd ).
dest = 'SAPFTP'.
call function 'HTTP_SCRAMBLE'
EXPORTING
source = pwd
sourcelen = slen
key = key
IMPORTING
destination = pwd.
call function 'FTP_CONNECT'
EXPORTING
user = 'saptest'
password = pwd
host = '11.11.11.11'
rfc_destination = dest
IMPORTING
handle = hdl.
call function 'SYSTEM_UUID_C_CREATE'
IMPORTING
uuid = docid.
call function 'FTP_R3_TO_CLIENT'
EXPORTING
fname = docid
rfc_destination = dest
character_mode = 'X'
TABLES
text = file_tab.
concatenate 'cd' 'dev/mwheel/s2m' into cmd separated by ' '.
refresh result.
call function 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
text = cmd.
call function 'FTP_COMMAND'
EXPORTING
handle = hdl
command = cmd
TABLES
data = result
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3.
if sy-subrc ne 0. error = 1. exit. endif.
clear cmd.
cmd = 'ascii'.
refresh result.
call function 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
text = cmd.
call function 'FTP_COMMAND'
EXPORTING
handle = hdl
command = cmd
TABLES
data = result
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3.
if sy-subrc ne 0. error = 1. exit. endif.
clear cmd.
concatenate 'put' docid f_filename into cmd separated by ' '.
refresh result.
call function 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
text = cmd.
call function 'FTP_COMMAND'
EXPORTING
handle = hdl
command = cmd
TABLES
data = result
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3.
if sy-subrc ne 0. error = 1. exit. endif.
loop at result.
write: / result-line.
endloop.
skip 1.
call function 'FTP_DISCONNECT'
EXPORTING
handle = hdl.
call function 'RFC_CONNECTION_CLOSE'
EXPORTING
destination = dest
EXCEPTIONS
others = 1.
if error ne 0.
format color col_negative.
write: / 'Error im Test'.
else.
format color col_positive.
write: / ' Test OK'.
endif.
endif.
Thanks in advance,
Finbarr