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 simplext 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.
Check also   Update Characteristic Value for SAP Customer with Sample ABAP Code

ABAP Report to Upload Excel File in SAP

Here a sampe 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 suprised with how many opportunities it gives.

Check also   Credit Limit for Customer in SAP SD

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

Sab125

Hi. I have been working as SAP Technical and functional for a decade. Through this blog, I am trying to share with you my experience. Hopefull, it makes your ways easier path ...Sab