EXCEL 内容:
读取内容:
代码:
TYPES: BEGIN OF ITAB,
FL1(50) TYPE C,
FL2(50) TYPE C,
FL3(50) TYPE C,
FL4(50) TYPE C,
FL5(50) TYPE C,
FL6(50) TYPE C,
END OF ITAB.
DATA: T_ITEM TYPE TABLE OF ITAB WITH HEADER LINE.
TYPES TRUXS_T_TEXT_DATA(4096) TYPE C OCCURS 0.
DATA: IL_RAW TYPE TRUXS_T_TEXT_DATA,P_LOAD LIKE RLGRAP-FILENAME .
P_LOAD = 'C:\XXX\TEST.xlsx'.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
* I_FIELD_SEPERATOR = 分隔符,默认为Tab
* I_LINE_HEADER = '' "'X' "文本中的第一行是否是标题头,如果是则不会读取
I_TAB_RAW_DATA = IL_RAW"该参数实际上没有使用到,但为必输参数
I_FILENAME = P_LOAD"文件路径
TABLES
I_TAB_CONVERTED_DATA = T_ITEM"返回值内表
* EXCEPTIONS
* CONVERSION_FAILED = 1
* OTHERS = 2
.
IF SY-SUBRC <> 0.
ENDIF.