ABAP-本地文件上载到SAP 服务器
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
DATA: fname TYPE rlgrap-filename,
ftype TYPE rlgrap-filetype,
fsize TYPE i.
DATA: fname_p TYPE string,
fname_n TYPE string.
DATA: sfname_p TYPE string .
DATA: sfname LIKE rcgiedial-iefile.
sfname_p = './'.
DATA: r(1) TYPE c.
DATA: data_tab LIKE rcgrepfile OCCURS 10 WITH HEADER LINE. DATA: lines TYPE i.
CALL FUNCTION 'UPLOAD'
EXPORTING
filename = 'c:/'
filetype = 'BIN'
filetype_no_change = 'X'
IMPORTING
filesize = fsize
act_filename = fname
act_filetype = ftype
TABLES
data_tab = data_tab
EXCEPTIONS
conversion_error = 1
invalid_table_width = 2
invalid_type = 3.
fname_n = fname.
DO.
SPLIT fname_n AT '/' INTO fname_p fname_n.
SEARCH fname_n FOR '/'.
IF sy-subrc = 4.
EXIT.
ENDIF.
ENDDO.
fname_p = fname.
SHIFT fname_p RIGHT DELETING TRAILING fname_n. SHIFT fname_p LEFT DELETING LEADING space. CONCATENATE sfname_p fname_n INTO sfname.
DESCRIBE TABLE data_tab LINES lines.
CALL FUNCTION 'C13Z_RAWDATA_WRITE' EXPORTING
i_file = sfname
i_file_size = fsize
i_lines = lines
TABLES
i_rcgrepfile_tab = data_tab
EXCEPTIONS
no_permission = 1
open_failed = 2
OTHERS = 3.
IF sy-subrc NE 0.
MESSAGE i000(znyj13) WITH 'UPLOAD SUCC'. ENDIF.
WRITE: 'SY-SUBRC:', sy-subrc,
/ '上载的本地文件名:', (60) fname,
/ '上载的远程文件名:',(60) sfname,
/ '文件类型:', ftype,
/ '文件大小:', fsize.
SKIP.