Home > ABAP, API > Function module to upload Excel

Function module to upload Excel

September 13th, 2009 Leave a comment Go to comments

Below two function modules can be used to upload the excel data to an internal table.

ALSM_EXCEL_TO_INTERNAL_TABLE
TEXT_CONVERT_XLS_TO_SAP

Function module ALSM_EXCEL_TO_INTERNAL_TABLE has more control to the Excel file, but function module TEXT_CONVERT_XLS_TO_SAP is the easiest way to upload excel file to the internal table.

  CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
    EXPORTING
      i_line_header              = 'X'
      i_tab_raw_data             = lt_raw
      i_filename                 = p_path
    TABLES
      i_tab_converted_data       = gt_output
    EXCEPTIONS
      conversion_failed          = 1
      OTHERS                     = 2.

The interest thing is that above two function modules use two SAP technologies to implement the functionality. One uses OLE(Object Linking and  Embedding), and the other uses DOI(Desktop Office Integration). DOI is an substitution of OLE technology. It encapsulates the implementation to ABAP class and it is easy to understand and use.

SAP document about DOI:
http://help.sap.com/saphelp_nw2004s/helpdata/EN/e9/0be775408e11d1893b0000e8323c4f/frameset.htm

SAP Demo Program about DOI: SAPRDEMOEXCELINTEGRATION.

SAP document about OLE:
http://help.sap.com/saphelp_46c/helpdata/EN/59/ae3c98488f11d189490000e829fbbd/frameset.htm

  1. No comments yet.
  1. No trackbacks yet.