report ztest131 message-id zmsg line-size 136 line-count 33
no standard page heading.
data: user(30) type c value 'sap' ,
pwd(30) type c value 'sapftp1234a',
host(64) type c value '10.12.38.45',
ftp_pwd(30) type c,
dest like rfcdes-rfcdest value 'SAPFTPA',
key type i value 26101957,
slen type i,
hdl type i,
compress type c value 'N' ,
cc_ascii(5) value 'ascii',
ftpcommand(100) type c. "FTP㏑.
data: begin of result occurs 0,
line(100) type c,
end of result.
parameters : ftp_dir like epsf-epsdirnam default '\backup',
sap_dir like epsf-epsdirnam default 'e:\FTP\PLM\'.
slen = strlen( pwd ).
call function 'HTTP_SCRAMBLE'
exporting
source = pwd
sourcelen = slen
key = key
importing
destination = ftp_pwd.
call function 'FTP_CONNECT'
exporting
user = user
password = ftp_pwd
host = host
rfc_destination = dest
importing
handle = hdl.
if sy-subrc = 0.
write:/ 'RFC Connection Sucessful', sy-subrc.
else.
write:/ 'RFC Connection Fails', sy-subrc.
check 1 = 2.
endif.
*---------->
data: i_filenm(60),
st_comm(250),
wk_lpath(60),
tb_comm like table of st_comm.
refresh: tb_comm.
clear: st_comm.
concatenate 'lcd' sap_dir into st_comm separated by space.
append st_comm to tb_comm.
clear: st_comm.
concatenate 'cd' ftp_dir into st_comm separated by space.
append st_comm to tb_comm.
clear: st_comm.
concatenate 'mput' '*.*' into st_comm separated by space.
append st_comm to tb_comm.
clear: st_comm.
*--------->
data:st_rslt(100) type c,
tb_rslt like table of st_rslt.
call function 'FTP_COMMAND_LIST'
exporting
handle = hdl
tables
data = tb_rslt
commands = tb_comm
exceptions
command_error = 1
tcpip_error = 2.
case sy-subrc.
when '1'.
result = 'N'.
write :/(10) sy-subrc,
(10) 'Command Error'.
when '2'.
result = 'N'.
write :/(10) sy-subrc,
(10) 'Tcpip Error'.
when others.
result = 'Y'.
endcase.
call function 'FTP_DISCONNECT'
exporting
handle = hdl.
call function 'RFC_CONNECTION_CLOSE'
exporting
destination = dest
exceptions
others = 1.