BASIS Function module Used the same way in S/4HANA

GUI_DOWNLOAD Download Internal Table to PC

Writes the content of an internal table to the user's PC as a text or binary file through SAP GUI. Programs that export report results as tab-delimited or CSV files use it. Use the FIELDNAMES table for column headings and pass WRITE_FIELD_SEPARATOR = 'X' with a suitable CODEPAGE so the file opens correctly in Excel; it does not run in the background.

Function group
SFES
Remote-enabled (RFC)
No
Type
Function module

Importing parameters

ParameterTypeDescriptionRequired
FILENAMESTRINGFile name (full path)Yes
FILETYPECHAR10File type (ASC, BIN, DAT)—
WRITE_FIELD_SEPARATORCHAR01Separate fields with tab—
CODEPAGEABAP_ENCODINGCode page—
APPENDCHAR01Append to existing file—

Exporting parameters

ParameterTypeDescription
FILELENGTHIWritten file length

Tables parameters

ParameterTypeDescriptionRequired
DATA_TAB—Data tableYes
FIELDNAMES—Column headings—

Exceptions

  • ACCESS_DENIED — Access denied
  • CONTROL_FLUSH_ERROR — Control flush error
  • DATAPROVIDER_EXCEPTION — Data provider exception
  • DISK_FULL — Disk full
  • DP_ERROR_CREATE — Data provider create error
  • DP_ERROR_SEND — Data provider send error
  • DP_ERROR_WRITE — Data provider write error
  • DP_OUT_OF_MEMORY — Data provider out of memory
  • DP_TIMEOUT — Data provider timeout
  • FILESIZE_NOT_ALLOWED — File size not allowed
  • FILE_NOT_FOUND — File not found
  • FILE_WRITE_ERROR — File write 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)

A skeleton generated from the interface. It lists mandatory importing parameters, exporting parameters and tables; declare the variables with suitable types in your own program.

CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
    filename = lv_filename
  IMPORTING
    filelength = lv_filelength
  TABLES
    data_tab = lt_data_tab
    fieldnames = lt_fieldnames
  EXCEPTIONS
    access_denied = 1
    control_flush_error = 2
    dataprovider_exception = 3
    disk_full = 4
    dp_error_create = 5
    dp_error_send = 6
    dp_error_write = 7
    dp_out_of_memory = 8
    OTHERS = 9.

Can't find the report you need?

We also build anything that is not in the catalog. Describe it briefly and we will suggest the right solution.

Request a custom report