REPORT YTEST015 .
*定义读入EXCEL的内表
DATA:BEGIN OF IEXCEL OCCURS 0.
INCLUDE STRUCTURE ALSMEX_TABLINE.
DATA:END OF IEXCEL.
*输入文件名参数
PARAMETERS: FN1 LIKE RLGRAP-FILENAME MEMORY ID M01.
*从已知文件名读入内表
CALL FUNCTION ’ALSM_EXCEL_TO_INTERNAL_TABLE’
EXPORTING
FILENAME = FN1
I_BEGIN_COL = 1
I_BEGIN_ROW = 1
I_END_COL = 100 " 最大列数据
I_END_ROW = 1000 "最大行数
TABLES
INTERN = IEXCEL
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
WRITE:/ ’读入文件错误!’,fn1.
ELSE.
*循环读取内表并打印
LOOP AT IEXCEL.
WRITE IEXCEL-VALUE(2).
AT END OF ROW.
WRITE:/ .
ENDAT.
ENDLOOP.
ENDIF.