# GUI_UPLOAD — Upload File from PC

> Reads a text or binary file from the user's PC into an internal table through SAP GUI. Almost every upload program that loads data from tab-delimited text or CSV files uses it. Pass HAS_FIELD_SEPARATOR = 'X' for tab-delimited files and choose the right CODEPAGE for national characters (e.g. 4110 for UTF-8); it does not run in the background, so use OPEN DATASET for server files.

- Modules: BASIS
- Type: Function module
- Function group: SFES
- Remote-enabled (RFC): No
- S/4HANA status: Used the same way in S/4HANA
- URL: https://nekuhub.com/en/functions/gui-upload/

## Importing parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| FILENAME | STRING | File name (full path) | Yes |
| FILETYPE | CHAR10 | File type (ASC, BIN, DAT) | - |
| HAS_FIELD_SEPARATOR | CHAR01 | Fields separated by tab | - |
| CODEPAGE | ABAP_ENCODING | Code page | - |
| READ_BY_LINE | CHAR01 | Read line by line | - |

## Exporting parameters

| Parameter | Type | Description |
|---|---|---|
| FILELENGTH | I | File length |
| HEADER | XSTRING | File header |

## Changing parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| ISSCANPERFORMED | CHAR01 | Virus scan performed | - |

## Tables parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| DATA_TAB | - | Data table | Yes |

## Exceptions

- ACCESS_DENIED: Access denied
- BAD_DATA_FORMAT: Bad data format
- DISK_FULL: Disk full
- DP_OUT_OF_MEMORY: Data provider out of memory
- DP_TIMEOUT: Data provider timeout
- FILE_OPEN_ERROR: File open error
- FILE_READ_ERROR: File read error
- GUI_REFUSE_FILETRANSFER: SAP GUI refused file transfer
- HEADER_NOT_ALLOWED: Header not allowed
- HEADER_TOO_LONG: Header too long
- INVALID_TYPE: Invalid file type
- NO_AUTHORITY: No authorization
- NO_BATCH: Cannot run in background
- SEPARATOR_NOT_ALLOWED: Separator not allowed
- UNKNOWN_DP_ERROR: Unknown data provider error
- UNKNOWN_ERROR: Unknown error

## Call template (ABAP)

```abap
CALL FUNCTION 'GUI_UPLOAD'
  EXPORTING
    filename = lv_filename
  IMPORTING
    filelength = lv_filelength
    header = lv_header
  CHANGING
    isscanperformed = lv_isscanperformed
  TABLES
    data_tab = lt_data_tab
  EXCEPTIONS
    access_denied = 1
    bad_data_format = 2
    disk_full = 3
    dp_out_of_memory = 4
    dp_timeout = 5
    file_open_error = 6
    file_read_error = 7
    gui_refuse_filetransfer = 8
    OTHERS = 9.
```


