# TEXT_CONVERT_XLS_TO_SAP — Convert Excel File to SAP Format

> Reads an Excel file and converts its content directly into the structure of the target internal table (by column order). Upload programs use it to load Excel data into a typed table in one step. Pass I_LINE_HEADER = 'X' if there is a header row; I_TAB_RAW_DATA is mandatory but can be passed empty, and SAP GUI plus Excel on the PC are required.

- Modules: BASIS
- Type: Function module
- Function group: TRUX
- Remote-enabled (RFC): No
- S/4HANA status: Used the same way in S/4HANA
- URL: https://nekuhub.com/en/functions/text-convert-xls-to-sap/

## Importing parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| I_FILENAME | RLGRAP-FILENAME | File name | Yes |
| I_TAB_RAW_DATA | TRUXS_T_TEXT_DATA | Raw data table | Yes |
| I_LINE_HEADER | CHAR01 | Skip header line | - |
| I_FIELD_SEPERATOR | CHAR01 | Field separator | - |

## Tables parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| I_TAB_CONVERTED_DATA | STANDARD TABLE | Converted data (target table) | Yes |

## Exceptions

- CONVERSION_FAILED: Conversion failed

## Call template (ABAP)

```abap
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
  EXPORTING
    i_filename = lv_i_filename
    i_tab_raw_data = lv_i_tab_raw_data
  TABLES
    i_tab_converted_data = lt_i_tab_converted_data
  EXCEPTIONS
    conversion_failed = 1
    OTHERS = 2.
```


