sap中用abap语法将excel数据导入到内表

report  ytest67.

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(20).
    at end of row .
      write: / .
    endat.
  endloop.
endif. 

 

要注意excel必须是标准MS格式的,否则不能识别,从而系统报错。

你可能感兴趣的:(sap中用abap语法将excel数据导入到内表)