SAP ABAP 如何读取EXCEL数据到内表
1个回答
展开全部
读取EXCEL数据到内表并输出调用函数: ALSM_EXCEL_TO_INTERNAL_TABLE *&---------------------------------------------------------------------**& Report ZCMH0009*&*&---------------------------------------------------------------------**& 读取EXCEL 的数据 到内表*&*&---------------------------------------------------------------------*REPORT ZCMH0009.INCLUDE OLE2INCL. "定义OLE变量DATA: BEGIN OF IEXCEL OCCURS 0. INCLUDE STRUCTURE ALSMEX_TABLINE.DATA: END OF IEXCEL.DATA: XLS LIKE RLGRAP-FILENAME VALUE 'C:\sap_usr02.xls'.CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE' EXPORTING FILENAME = XLS
I_BEGIN_COL = 1 I_BEGIN_ROW = 1 I_END_COL = 100 " 读取多少列 I_END_ROW = 100 "读取多少行 TABLES INTERN = IEXCEL
EXCEPTIONS INCONSISTENT_PARAMETERS = 1 UPLOAD_OLE = 2 OTHERS = 3."读取后内表保存的结构为:第一行记录第一个单元的行值 列值 单元格内容 比如 0001 0001 第一个单元格内容WRITE: /.IF sy-subrc <> 0. WRITE: / XLS,'读入错误!'.ELSE. LOOP AT IEXCEL. WRITE IEXCEL-VALUE(20). "取前20个字符 AT END OF ROW. "每行行尾输出空行 WRITE : /. ENDAT. ENDLOOP.ENDIF.
I_BEGIN_COL = 1 I_BEGIN_ROW = 1 I_END_COL = 100 " 读取多少列 I_END_ROW = 100 "读取多少行 TABLES INTERN = IEXCEL
EXCEPTIONS INCONSISTENT_PARAMETERS = 1 UPLOAD_OLE = 2 OTHERS = 3."读取后内表保存的结构为:第一行记录第一个单元的行值 列值 单元格内容 比如 0001 0001 第一个单元格内容WRITE: /.IF sy-subrc <> 0. WRITE: / XLS,'读入错误!'.ELSE. LOOP AT IEXCEL. WRITE IEXCEL-VALUE(20). "取前20个字符 AT END OF ROW. "每行行尾输出空行 WRITE : /. ENDAT. ENDLOOP.ENDIF.
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询