*&---------------------------------------------------------------------* *& Report Z003 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT Z003. TYPES:BEGIN OF XXX, F1 TYPE CHAR10, F2 TYPE CHAR10, END OF XXX. DATA LT_TABLE TYPE TABLE OF XXX. PARAMETERS: P_FILES TYPE RLGRAP-FILENAME . AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILES. CALL FUNCTION 'WS_FILENAME_GET' EXPORTING * DEF_FILENAME = ' ' * DEF_PATH = ' ' * MASK = '' MODE = 'O' TITLE = '上传文件 ' IMPORTING FILENAME = P_FILES * RC = * EXCEPTIONS * INV_WINSYS = 1 * NO_BATCH = 2 * SELECTION_CANCEL = 3 * SELECTION_ERROR = 4 * OTHERS = 5 . IF SY-SUBRC <> 0. * Implement suitable error handling here ENDIF. START-OF-SELECTION. DATA LV_FILE TYPE STRING. LV_FILE = P_FILES. CALL FUNCTION 'GUI_UPLOAD' EXPORTING FILENAME = LV_FILE * FILETYPE = 'ASC' HAS_FIELD_SEPARATOR = 'X' * HEADER_LENGTH = 0 * READ_BY_LINE = 'X' * DAT_MODE = ' ' * CODEPAGE = ' ' * IGNORE_CERR = ABAP_TRUE * REPLACEMENT = '#' * CHECK_BOM = ' ' * VIRUS_SCAN_PROFILE = * NO_AUTH_CHECK = ' ' * IMPORTING * FILELENGTH = * HEADER = TABLES DATA_TAB = LT_TABLE * CHANGING * ISSCANPERFORMED = ' ' * EXCEPTIONS * FILE_OPEN_ERROR = 1 * FILE_READ_ERROR = 2 * NO_BATCH = 3 * GUI_REFUSE_FILETRANSFER = 4 * INVALID_TYPE = 5 * NO_AUTHORITY = 6 * UNKNOWN_ERROR = 7 * BAD_DATA_FORMAT = 8 * HEADER_NOT_ALLOWED = 9 * SEPARATOR_NOT_ALLOWED = 10 * HEADER_TOO_LONG = 11 * UNKNOWN_DP_ERROR = 12 * ACCESS_DENIED = 13 * DP_OUT_OF_MEMORY = 14 * DISK_FULL = 15 * DP_TIMEOUT = 16 * OTHERS = 17 . IF SY-SUBRC = 0. DATA LEN TYPE I. DESCRIBE TABLE LT_TABLE LINES LEN. WRITE LEN. ENDIF.
标签:DATA,GUI,UPLOAD,FILENAME,FILE,ERROR,TABLE,txt,TYPE From: https://www.cnblogs.com/hua900822/p/17320944.html