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 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.?

TEXT_CONVERT_XLS_TO_SAP: Excel FM in SAP

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 to 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.