1、下传文件
TYPES:BEGIN OF TY_DATA, A2 TYPE CHAR20, B2 TYPE I, C2 TYPE CHAR20, END OF TY_DATA. DATA:IT_DATA TYPE STANDARD TABLE OF TY_DATA WITH HEADER LINE, WA_DATA TYPE TY_DATA. DATA:IT_DATA1 TYPE STANDARD TABLE OF TY_DATA WITH HEADER LINE, WA_DATA1 TYPE TY_DATA. DATA:NAME TYPE RLGRAP-FILENAME,TYPA TYPE RLGRAP-FILETYPE. WA_DATA-A2 = '我是'. WA_DATA-B2 = 1. WA_DATA-C2 = '个中国人'. APPEND WA_DATA TO IT_DATA. CLEAR:WA_DATA. WA_DATA-A2 = '你是'. WA_DATA-B2 = 10. WA_DATA-C2 = '全10美的人'. APPEND WA_DATA TO IT_DATA. CLEAR:WA_DATA. NAME = 'D:TEMPTEXT.txt'. TYPA = 'DAT'. CALL FUNCTION 'DOWNLOAD' EXPORTING CODEPAGE = 'TEXT ' FILENAME = NAME FILETYPE = TYPA ITEM = '文件导出' TABLES DATA_TAB = IT_DATA 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. * Implement suitable error handling here ENDIF.
2、上传文件
CALL FUNCTION 'UPLOAD' EXPORTING CODEPAGE = 'TEXT ' FILENAME = NAME FILETYPE = TYPA ITEM = '读入文件 ' TABLES DATA_TAB = IT_DATA1 EXCEPTIONS CONVERSION_ERROR = 1 INVALID_TABLE_WIDTH = 2 INVALID_TYPE = 3 NO_BATCH = 4 UNKNOWN_ERROR = 5 GUI_REFUSE_FILETRANSFER = 6 OTHERS = 7. IF SY-SUBRC <> 0. * Implement suitable error handling here ENDIF. LOOP AT IT_DATA. WRITE:/ IT_DATA-A2,IT_DATA-B2,IT_DATA-C2. ENDLOOP.