Function to read Excel file

Function to read Excel file

Use FM ALSM_EXCEL_TO_INTERNAL_TABLE to read Excel file

Caution, this use OLE_Objects and can’t be run in background.


  CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    EXPORTING
      filename                = lw_file " Like : FILE://C:/Users/name/file.xls
      i_begin_col             = lw_first_col
      i_begin_row             = lw_first_row
      i_end_col               = lw_end_col
      i_end_row               = lw_end_row " set big value id end line is not known
    TABLES
      intern                  = it_excel_table
    EXCEPTIONS
      inconsistent_parameters = 1
      upload_ole              = 2
      OTHERS                  = 3.

  IF sy-subrc <> 0.
    " Handle error
  ENDIF.

About the author

fjourneau administrator

Hi, I'm Florian Journeau, SAP ABAP R3 Freelance, based in Toulouse, France. You want to know more about me, have a look on my CV : cv.fjourneau.net.

Leave a Reply