report rsftp002.
parameters: user(30) type c lower case,
pwd(30) type c lower case,
host(64) type c lower case,
cmd1(80) type c lower case,
cmd2(80) type c lower case,
cmd3(80) type c lower case,
dest like rfcdes-rfcdest default 'SAPFTP',
compress type c default 'N'.
data: hdl type i,
key type i value 26101957,
slen type i.
data: begin of result occurs 0,
line(100) type c,
end of result.
set extended check off.
slen = strlen( pwd ).
AUTHORITY-CHECK OBJECT 'S_ADMI_FCD'
ID 'S_ADMI_FCD'
FIELD 'SFTP'.
IF sy-subrc <> 0.
MESSAGE 'no_authorization' type 'E'.
exit.
* Keine Berechtigung zum Ändern der Aktivierung einer ID
ENDIF.
CALL FUNCTION 'HTTP_SCRAMBLE'
exporting
source = pwd
sourcelen = slen
key = key
importing
destination = pwd.
call function 'FTP_CONNECT'
exporting
user = user
password = pwd
host = host
rfc_destination = dest
importing
handle = hdl.
if cmd1 ne ' '.
call function 'FTP_COMMAND'
exporting
handle = hdl
command = cmd1
compress = compress
tables
data = result
exceptions
command_error = 1
tcpip_error = 2.
loop at result.
write at / result-line.
endloop.
refresh result.
endif.
if cmd2 ne ' '.
call function 'FTP_COMMAND'
exporting
handle = hdl
command = cmd2
tables
data = result
exceptions
command_error = 1
tcpip_error = 2.
loop at result.
write at / result-line.
endloop.
refresh result.
endif.
if cmd3 ne ' '.
call function 'FTP_COMMAND'
exporting
handle = hdl
command = cmd3
tables
data = result
exceptions
command_error = 1
tcpip_error = 2.
loop at result.
write at / result-line.
endloop.
refresh result.
endif.
call function 'FTP_DISCONNECT'
exporting
handle = hdl.
call function 'RFC_CONNECTION_CLOSE'
exporting
destination = dest
exceptions
others = 1.
* password not visible
at selection-screen output.
loop at screen.
if screen-name = 'PWD'.
screen-invisible = '1'.
modify screen.
endif.
endloop.
parameters: user(30) type c lower case,
pwd(30) type c lower case,
host(64) type c lower case,
cmd1(80) type c lower case,
cmd2(80) type c lower case,
cmd3(80) type c lower case,
dest like rfcdes-rfcdest default 'SAPFTP',
compress type c default 'N'.
data: hdl type i,
key type i value 26101957,
slen type i.
data: begin of result occurs 0,
line(100) type c,
end of result.
set extended check off.
slen = strlen( pwd ).
AUTHORITY-CHECK OBJECT 'S_ADMI_FCD'
ID 'S_ADMI_FCD'
FIELD 'SFTP'.
IF sy-subrc <> 0.
MESSAGE 'no_authorization' type 'E'.
exit.
* Keine Berechtigung zum Ändern der Aktivierung einer ID
ENDIF.
CALL FUNCTION 'HTTP_SCRAMBLE'
exporting
source = pwd
sourcelen = slen
key = key
importing
destination = pwd.
call function 'FTP_CONNECT'
exporting
user = user
password = pwd
host = host
rfc_destination = dest
importing
handle = hdl.
if cmd1 ne ' '.
call function 'FTP_COMMAND'
exporting
handle = hdl
command = cmd1
compress = compress
tables
data = result
exceptions
command_error = 1
tcpip_error = 2.
loop at result.
write at / result-line.
endloop.
refresh result.
endif.
if cmd2 ne ' '.
call function 'FTP_COMMAND'
exporting
handle = hdl
command = cmd2
tables
data = result
exceptions
command_error = 1
tcpip_error = 2.
loop at result.
write at / result-line.
endloop.
refresh result.
endif.
if cmd3 ne ' '.
call function 'FTP_COMMAND'
exporting
handle = hdl
command = cmd3
tables
data = result
exceptions
command_error = 1
tcpip_error = 2.
loop at result.
write at / result-line.
endloop.
refresh result.
endif.
call function 'FTP_DISCONNECT'
exporting
handle = hdl.
call function 'RFC_CONNECTION_CLOSE'
exporting
destination = dest
exceptions
others = 1.
* password not visible
at selection-screen output.
loop at screen.
if screen-name = 'PWD'.
screen-invisible = '1'.
modify screen.
endif.
endloop.
감사합니다.