【ABAP】FTP Program
ABAP FTP Program
[@more@]-------------------------------------------------------------------------------
DATA: l_hdl TYPE i,
l_key TYPE i VALUE 26101957,
l_slen TYPE i,
l_compress TYPE c VALUE 'N',
l_ftp_filename(80) TYPE c,
l_cmd(80) TYPE c .
DATA: ls_result TYPE ts_cmd_result,
lt_result LIKE TABLE OF ls_result.
l_slen = STRLEN( pwd ).
CALL FUNCTION 'HTTP_SCRAMBLE'
EXPORTING
SOURCE = pwd
sourcelen = l_slen
key = l_key
IMPORTING
destination = pwd.
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
user = user
password = pwd
host = host
rfc_destination = dest
IMPORTING
handle = l_hdl.
*enter directory
CONCATENATE 'cd' pa_filea INTO l_cmd SEPARATED BY space.
PERFORM exec_command USING l_hdl l_cmd l_compress CHANGING lt_result.
"CONCATENATE host pa_filea INTO l_fname.
PERFORM filename_timestamp CHANGING l_ftp_filename.
CALL FUNCTION 'FTP_R3_TO_SERVER'
EXPORTING
handle = l_hdl
fname = l_ftp_filename
character_mode = 'X'
TABLES
text = gt_record.
IF sy-subrc = 0.
MESSAGE s013.
ENDIF.
* Disconnect
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
handle = l_hdl.
CALL FUNCTION 'RFC_CONNECTION_CLOSE'
EXPORTING
destination = dest
EXCEPTIONS
OTHERS = 1.
-------------------------------------------------------------------------------
FORM exec_command USING p_hdlp_cmd
p_compress
CHANGING pt_result TYPE tt_cmd_result.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = p_hdl
command = p_cmd
compress = p_compress
TABLES
data = pt_result
EXCEPTIONS
command_error = 1
tcpip_error = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " EXEC_COMMAND
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8214011/viewspace-1060385/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- SAP Hybris的型別系統更改和ABAP的LOAD_PROGRAM_TABLE_MISMATCH型別
- Spark Driver Program剖析Spark
- Registering a program on the GatewayGateway
- Run a program as a service (daemon)-GOGo
- Program Units and Referenced Objects (244)Object
- Overview of the Program Global Areas (97)View
- Program Interface Structure (135)Struct
- pwn.college-Program Misuse
- HDU - 6736 F - Forest ProgramREST
- SAP APP: Automatic Payment ProgramAPP
- Program Execution 程式的執行
- Program perl 資料結構資料結構
- Individual Project - Word frequency programProject
- oracle concurrent program session and sqlOracleSessionSQL
- Oracle Scheduler(5)job呼叫programOracle
- The Network Program Log Two (Scapy)
- Profiling an Assembly Program
- pwn.college Fundementals Program interaction
- 北大FTP,除了北大FTP其他好用的FTP軟體FTP
- FTPFTP
- 物件啟用用得到的Program物件
- Could not find the main class. Program will exitAI
- Record for Individual Project ( Word frequency program )Project
- the program list about oracle database in SAP systemOracleDatabase
- 主動FTP與被動FTPFTP
- ftp,安全ftp軟體哪個好FTP
- Quartz.net-控制檯例項-Programquartz
- Apple Developer Program全球電話支援APPDeveloper
- Autodesk Cloud Accelerator Program 開始報名Cloud
- Oracle Scheduler(4)job呼叫program和scheduleOracle
- Compilation of Views and PL/SQL Program Units (242)ViewSQL
- PL/SQL Program Units and the Shared Pool (89)SQL
- centos ftpCentOSFTP
- ftp 配置FTP
- Ftp模式FTP模式
- ftp "CanFTP
- ftp serverFTPServer
- FTP,FTP連線的辦法,配置方式FTP