How to SAP Upload Excel File with TEXT_CONVERT_XLS_TO_SAP

Upload Excel File to internal table in SAP using the standard FM TEXT_CONVERT_XLS_TO_SAP is a common business requirement for fast upload data or mass data manipulation.

Find also a full ABAP Program, just copy and paste it and start playing with Excel.


The simplest way is to use standard function TEXT_CONVERT_XLS_TO_SAP

  • i_line_header: defines if the file has a header line (column for title)
  • i_filename : set the filename
  • i_tab_converted_data : is the internal table containing data from Excel file.

SAP Upload Excel File to ABAP Internal Table

Here a sample ABAP Program to upload Excel file to internal table in sap. It will take an Excel file as input and import the content to an ABAP internal table.

The step-step guide is :

  1. Call the Function F4_FILENAME: This function will help select the Excel file from your local driver.
  2. Call to the magical standard SAP TEXT_CONVERT_XLS_TO_SAP.
    Look above for the Function TEXT_CONVERT_XLS_TO_SAP signature and description.
    These function will return the data in Excel into SAP internal table.
  3. Display Excel content with a sample Write Structure.
    Do whatever you want with the data.

ABAP Report to Upload Excel File in SAP

Here a sample ABAP Report ready to be copied and which, hopefully, will help you as a skeleton for your Excel File processing in SAP.
In fact, this ABAP code will

  • upload an Excel File for Local (using the F4_FILENAME to select the Excel file)
  • and transfer all the Excel data to ABAP internal Table using TEXT_CONVERT_XLS_TO_SAP (to be displayed later).

Managing Excel file with ABAP: ABAP2XLSX

If you want to go further with Excel in SAP, have a look on the SAPLINK ABAP2XLSX. It is available in GitHub.
I have already used it with a productive project, and I was surprised with how many opportunities it gives.

For example, you can manage very easily the formatting of Cell with the ABAP2XLSX classes.
Handling Data to and from Excel, is a way more completed and easily using the predefined methods.