notice
SAP Analysts! If you haven’t noticed yet there is a new banner ad above. It is for SAP Analyst positions with Johns Manville. Click on the ad to apply.

Function module to upload Excel

September 13th, 2009 | Categories: ABAP, API | Tags: , ,

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

VN:F [1.8.4_1055]
Rating: 0.0/10 (0 votes cast)
VN:F [1.8.4_1055]
Rating: 0 (from 0 votes)
Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Blogplay
  • LinkedIn
  • Live
  • MySpace
  • Twitter
  • email
  • Identi.ca
  • Print
  • Yahoo! Bookmarks
No comments yet.