首页 > 代码库 > 下载文件
下载文件
DATA: BEGIN OF man,
name(20) TYPE c,
high TYPE p DECIMALS 2,
weight TYPE p DECIMALS 2,
END OF man.
DATA: man1 LIKE TABLE OF man.
DATA: name TYPE rlgrap-filename, typa TYPE rlgrap-filetype.
man-name = ‘张参‘.
man-high = ‘1.68‘.
man-weight = 120.
INSERT man INTO TABLE man1.
man-name = ‘刘志‘.
man-high = ‘1.78‘.
man-weight = 160.
INSERT man INTO TABLE man1.
man-name = ‘李志‘.
man-high = ‘1.58‘.
man-weight = 110.
INSERT man INTO man1 INDEX 2.
name = ‘C:\TEMP\TESTA.TXT‘.
typa = ‘DAT‘.
CALL FUNCTION ‘DOWNLOAD‘
EXPORTING
codepage = ‘TESTA‘
filename = name
filetype = typa
item = ‘文件测试‘
TABLES
data_tab = man1
EXCEPTIONS
invalid_filesize = 1
invalid_table_width = 2
invalid_type = 3
no_batch = 4
unknown_error = 5
gui_refuse_filetransfer = 6
OTHERS = 7.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
"打开运行实例存储文件,有以下内容:
"张参 1,68 120,00
"李志 1,58 110,00
"刘志 1,78 160,00
程序运行时弹出输入读入文件名的提示框,
将程序中“CALL FUNCTION ‘UPLOAD’”
改为“CALL FUNCTION ‘WS——UPLOAD’”,
程序运行时将不再提示直接读入文件。
下载文件