SAP GUI_DOWNLOAD Function Module for Download an Internal Table to the PC









GUI_DOWNLOAD is a standard gui download SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Download an Internal Table to the PC processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.


See here to view full function module documentation and code listing for gui download FM, simply by entering the name GUI_DOWNLOAD into the relevant SAP transaction such as SE37 or SE38.

Function Group: SFES
Program Name: SAPLSFES
Main Program: SAPLSFES
Appliation area:
Release date: 23-Mar-2001
Mode(Normal, Remote etc): Normal Function Module
Update:



Function GUI_DOWNLOAD pattern details

In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.
CALL FUNCTION 'GUI_DOWNLOAD'"Download an Internal Table to the PC
EXPORTING
* BIN_FILESIZE = "File length for binary files
* COL_SELECT_MASK = ' ' "Vector Containing an 'X' for the Column To Be Copied
* DAT_MODE = ' ' "Numeric and Date Fields Written in ws_download 'DAT' Format
* CONFIRM_OVERWRITE = ' ' "Overwrite File Only After Confirmation
* NO_AUTH_CHECK = ' ' "Switch off Check for Access Rights
* CODEPAGE = ' ' "Character Representation for Output
* IGNORE_CERR = ABAP_TRUE "Specifies whether to ignore errors converting character sets
* REPLACEMENT = '#' "Replacement Character for Non-Convertible Characters
* WRITE_BOM = ' ' "If set, writes a Unicode byte order mark
* TRUNC_TRAILING_BLANKS_EOL = 'X' "Removes spaces at end of last column
* WK1_N_FORMAT = ' ' "Format for value columns in files of the type WK1
FILENAME = "Name of file
* WK1_N_SIZE = ' ' "Column width for value columns in files of the type WK1
* WK1_T_FORMAT = ' ' "Format for text columns for files of the type WK1
* WK1_T_SIZE = ' ' "Column width for text columns for files of the type WK1
* WRITE_LF_AFTER_LAST_LINE = ABAP_TRUE "Writes LF even after last line
* SHOW_TRANSFER_STATUS = ABAP_TRUE "
* VIRUS_SCAN_PROFILE = '/SCET/GUI_DOWNLOAD' "Virus Scan Profile
* FILETYPE = 'ASC' "File Type (ASC or BIN)
* APPEND = ' ' "Writing mode (overwrite, append)
* WRITE_FIELD_SEPARATOR = ' ' "Separate Columns by Tabs in Case of ASCII Download
* HEADER = '00' "Byte Chain Written in Binary Mode at the Start of the File
* TRUNC_TRAILING_BLANKS = ' ' "Do not Write Blank at the End of Char Fields
* WRITE_LF = 'X' "Insert CR/LF at End of Line in Case of Char Download
* COL_SELECT = ' ' "Copy Single Columns of the Table Only

IMPORTING
FILELENGTH = "Number of bytes transferred

TABLES
DATA_TAB = "Transfer table
* FIELDNAMES = "Field Names for the 'DBF' File Type

EXCEPTIONS
FILE_WRITE_ERROR = 1 HEADER_TOO_LONG = 10 DP_ERROR_CREATE = 11 DP_ERROR_SEND = 12 DP_ERROR_WRITE = 13 UNKNOWN_DP_ERROR = 14 ACCESS_DENIED = 15 DP_OUT_OF_MEMORY = 16 DISK_FULL = 17 DP_TIMEOUT = 18 FILE_NOT_FOUND = 19 NO_BATCH = 2 DATAPROVIDER_EXCEPTION = 20 CONTROL_FLUSH_ERROR = 21 GUI_REFUSE_FILETRANSFER = 3 INVALID_TYPE = 4 NO_AUTHORITY = 5 UNKNOWN_ERROR = 6 HEADER_NOT_ALLOWED = 7 SEPARATOR_NOT_ALLOWED = 8 FILESIZE_NOT_ALLOWED = 9
.



IMPORTING Parameters details for GUI_DOWNLOAD

BIN_FILESIZE - File length for binary files

Data type: I
Optional: Yes
Call by Reference: Yes

COL_SELECT_MASK - Vector Containing an 'X' for the Column To Be Copied

Data type: CHAR255
Default: SPACE
Optional: Yes
Call by Reference: Yes

DAT_MODE - Numeric and Date Fields Written in ws_download 'DAT' Format

Data type: CHAR01
Default: SPACE
Optional: Yes
Call by Reference: Yes

CONFIRM_OVERWRITE - Overwrite File Only After Confirmation

Data type: CHAR01
Default: SPACE
Optional: Yes
Call by Reference: Yes

NO_AUTH_CHECK - Switch off Check for Access Rights

Data type: CHAR01
Default: SPACE
Optional: Yes
Call by Reference: Yes

CODEPAGE - Character Representation for Output

Data type: ABAP_ENCODING
Default: SPACE
Optional: Yes
Call by Reference: Yes

IGNORE_CERR - Specifies whether to ignore errors converting character sets

Data type: ABAP_BOOL
Default: ABAP_TRUE
Optional: Yes
Call by Reference: Yes

REPLACEMENT - Replacement Character for Non-Convertible Characters

Data type: ABAP_REPL
Default: '#'
Optional: Yes
Call by Reference: Yes

WRITE_BOM - If set, writes a Unicode byte order mark

Data type: ABAP_BOOL
Default: SPACE
Optional: Yes
Call by Reference: Yes

TRUNC_TRAILING_BLANKS_EOL - Removes spaces at end of last column

Data type: CHAR01
Default: 'X'
Optional: Yes
Call by Reference: Yes

WK1_N_FORMAT - Format for value columns in files of the type WK1

Data type:
Default: SPACE
Optional: Yes
Call by Reference: Yes

FILENAME - Name of file

Data type: STRING
Optional: No
Call by Reference: Yes

WK1_N_SIZE - Column width for value columns in files of the type WK1

Data type:
Default: SPACE
Optional: Yes
Call by Reference: Yes

WK1_T_FORMAT - Format for text columns for files of the type WK1

Data type:
Default: SPACE
Optional: Yes
Call by Reference: Yes

WK1_T_SIZE - Column width for text columns for files of the type WK1

Data type:
Default: SPACE
Optional: Yes
Call by Reference: Yes

WRITE_LF_AFTER_LAST_LINE - Writes LF even after last line

Data type: ABAP_BOOL
Default: ABAP_TRUE
Optional: Yes
Call by Reference: Yes

SHOW_TRANSFER_STATUS -

Data type: ABAP_BOOL
Default: ABAP_TRUE
Optional: Yes
Call by Reference: Yes

VIRUS_SCAN_PROFILE - Virus Scan Profile

Data type: VSCAN_PROFILE
Default: '/SCET/GUI_DOWNLOAD'
Optional: Yes
Call by Reference: Yes

FILETYPE - File Type (ASC or BIN)

Data type: CHAR10
Default: 'ASC'
Optional: Yes
Call by Reference: Yes

APPEND - Writing mode (overwrite, append)

Data type: CHAR01
Default: SPACE
Optional: Yes
Call by Reference: Yes

WRITE_FIELD_SEPARATOR - Separate Columns by Tabs in Case of ASCII Download

Data type: CHAR01
Default: SPACE
Optional: Yes
Call by Reference: Yes

HEADER - Byte Chain Written in Binary Mode at the Start of the File

Data type: XSTRING
Default: '00'
Optional: Yes
Call by Reference: Yes

TRUNC_TRAILING_BLANKS - Do not Write Blank at the End of Char Fields

Data type: CHAR01
Default: SPACE
Optional: Yes
Call by Reference: Yes

WRITE_LF - Insert CR/LF at End of Line in Case of Char Download

Data type: CHAR01
Default: 'X'
Optional: Yes
Call by Reference: Yes

COL_SELECT - Copy Single Columns of the Table Only

Data type: CHAR01
Default: SPACE
Optional: Yes
Call by Reference: Yes

EXPORTING Parameters details for GUI_DOWNLOAD

FILELENGTH - Number of bytes transferred

Data type: I
Optional: No
Call by Reference: No ( called with pass by value option)

TABLES Parameters details for GUI_DOWNLOAD

DATA_TAB - Transfer table

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

FIELDNAMES - Field Names for the 'DBF' File Type

Data type:
Optional: Yes
Call by Reference: Yes

EXCEPTIONS details

FILE_WRITE_ERROR - Cannot write to file

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

HEADER_TOO_LONG - The header information is limited to 1023 bytes at present

Data type:
Optional: No
Call by Reference: Yes

DP_ERROR_CREATE - Cannot Create Data Provider

Data type:
Optional: No
Call by Reference: Yes

DP_ERROR_SEND - Error Sending Data with DataProvider

Data type:
Optional: No
Call by Reference: Yes

DP_ERROR_WRITE - Error Writing Data with DataProvider

Data type:
Optional: No
Call by Reference: Yes

UNKNOWN_DP_ERROR - Error when calling data provider

Data type:
Optional: No
Call by Reference: Yes

ACCESS_DENIED - Access to File Denied

Data type:
Optional: No
Call by Reference: Yes

DP_OUT_OF_MEMORY - Not enough memory in data provider

Data type:
Optional: No
Call by Reference: Yes

DISK_FULL - Storage Medium Full

Data type:
Optional: No
Call by Reference: Yes

DP_TIMEOUT - Data provider timeout

Data type:
Optional: No
Call by Reference: Yes

FILE_NOT_FOUND - Could not find file

Data type:
Optional: No
Call by Reference: Yes

NO_BATCH - Cannot execute front-end function in background

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

DATAPROVIDER_EXCEPTION - General Exception Error in Data Provider

Data type:
Optional: No
Call by Reference: Yes

CONTROL_FLUSH_ERROR - Error in Control Framework

Data type:
Optional: No
Call by Reference: Yes

GUI_REFUSE_FILETRANSFER - Incorrect Front End

Data type:
Optional: No
Call by Reference: Yes

INVALID_TYPE - Invalid value for parameter FILETYPE

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

NO_AUTHORITY - No Download Authorization

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

UNKNOWN_ERROR -

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

HEADER_NOT_ALLOWED - Invalid header

Data type:
Optional: No
Call by Reference: Yes

SEPARATOR_NOT_ALLOWED - Invalid separator

Data type:
Optional: No
Call by Reference: Yes

FILESIZE_NOT_ALLOWED - Invalid file size

Data type:
Optional: No
Call by Reference: Yes

Copy and paste ABAP code example for GUI_DOWNLOAD Function Module

The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.

DATA:
lt_data_tab  TYPE STANDARD TABLE OF STRING, "   
lv_filelength  TYPE I, "   
lv_bin_filesize  TYPE I, "   
lv_file_write_error  TYPE I, "   
lv_col_select_mask  TYPE CHAR255, "   SPACE
lv_header_too_long  TYPE CHAR255, "   
lv_dat_mode  TYPE CHAR01, "   SPACE
lv_dp_error_create  TYPE CHAR01, "   
lv_dp_error_send  TYPE CHAR01, "   
lv_confirm_overwrite  TYPE CHAR01, "   SPACE
lv_no_auth_check  TYPE CHAR01, "   SPACE
lv_dp_error_write  TYPE CHAR01, "   
lv_codepage  TYPE ABAP_ENCODING, "   SPACE
lv_unknown_dp_error  TYPE ABAP_ENCODING, "   
lv_ignore_cerr  TYPE ABAP_BOOL, "   ABAP_TRUE
lv_access_denied  TYPE ABAP_BOOL, "   
lv_replacement  TYPE ABAP_REPL, "   '#'
lv_dp_out_of_memory  TYPE ABAP_REPL, "   
lv_disk_full  TYPE ABAP_REPL, "   
lv_write_bom  TYPE ABAP_BOOL, "   SPACE
lv_dp_timeout  TYPE ABAP_BOOL, "   
lv_trunc_trailing_blanks_eol  TYPE CHAR01, "   'X'
lv_wk1_n_format  TYPE CHAR01, "   SPACE
lv_file_not_found  TYPE CHAR01, "   
lv_filename  TYPE STRING, "   
lv_no_batch  TYPE STRING, "   
lt_fieldnames  TYPE STANDARD TABLE OF STRING, "   
lv_wk1_n_size  TYPE STRING, "   SPACE
lv_dataprovider_exception  TYPE STRING, "   
lv_wk1_t_format  TYPE STRING, "   SPACE
lv_control_flush_error  TYPE STRING, "   
lv_wk1_t_size  TYPE STRING, "   SPACE
lv_write_lf_after_last_line  TYPE ABAP_BOOL, "   ABAP_TRUE
lv_show_transfer_status  TYPE ABAP_BOOL, "   ABAP_TRUE
lv_virus_scan_profile  TYPE VSCAN_PROFILE, "   '/SCET/GUI_DOWNLOAD'
lv_filetype  TYPE CHAR10, "   'ASC'
lv_gui_refuse_filetransfer  TYPE CHAR10, "   
lv_append  TYPE CHAR01, "   SPACE
lv_invalid_type  TYPE CHAR01, "   
lv_no_authority  TYPE CHAR01, "   
lv_write_field_separator  TYPE CHAR01, "   SPACE
lv_header  TYPE XSTRING, "   '00'
lv_unknown_error  TYPE XSTRING, "   
lv_header_not_allowed  TYPE XSTRING, "   
lv_trunc_trailing_blanks  TYPE CHAR01, "   SPACE
lv_write_lf  TYPE CHAR01, "   'X'
lv_separator_not_allowed  TYPE CHAR01, "   
lv_col_select  TYPE CHAR01, "   SPACE
lv_filesize_not_allowed  TYPE CHAR01. "   

  CALL FUNCTION 'GUI_DOWNLOAD'  "Download an Internal Table to the PC
    EXPORTING
         BIN_FILESIZE = lv_bin_filesize
         COL_SELECT_MASK = lv_col_select_mask
         DAT_MODE = lv_dat_mode
         CONFIRM_OVERWRITE = lv_confirm_overwrite
         NO_AUTH_CHECK = lv_no_auth_check
         CODEPAGE = lv_codepage
         IGNORE_CERR = lv_ignore_cerr
         REPLACEMENT = lv_replacement
         WRITE_BOM = lv_write_bom
         TRUNC_TRAILING_BLANKS_EOL = lv_trunc_trailing_blanks_eol
         WK1_N_FORMAT = lv_wk1_n_format
         FILENAME = lv_filename
         WK1_N_SIZE = lv_wk1_n_size
         WK1_T_FORMAT = lv_wk1_t_format
         WK1_T_SIZE = lv_wk1_t_size
         WRITE_LF_AFTER_LAST_LINE = lv_write_lf_after_last_line
         SHOW_TRANSFER_STATUS = lv_show_transfer_status
         VIRUS_SCAN_PROFILE = lv_virus_scan_profile
         FILETYPE = lv_filetype
         APPEND = lv_append
         WRITE_FIELD_SEPARATOR = lv_write_field_separator
         HEADER = lv_header
         TRUNC_TRAILING_BLANKS = lv_trunc_trailing_blanks
         WRITE_LF = lv_write_lf
         COL_SELECT = lv_col_select
    IMPORTING
         FILELENGTH = lv_filelength
    TABLES
         DATA_TAB = lt_data_tab
         FIELDNAMES = lt_fieldnames
    EXCEPTIONS
        FILE_WRITE_ERROR = 1
        HEADER_TOO_LONG = 10
        DP_ERROR_CREATE = 11
        DP_ERROR_SEND = 12
        DP_ERROR_WRITE = 13
        UNKNOWN_DP_ERROR = 14
        ACCESS_DENIED = 15
        DP_OUT_OF_MEMORY = 16
        DISK_FULL = 17
        DP_TIMEOUT = 18
        FILE_NOT_FOUND = 19
        NO_BATCH = 2
        DATAPROVIDER_EXCEPTION = 20
        CONTROL_FLUSH_ERROR = 21
        GUI_REFUSE_FILETRANSFER = 3
        INVALID_TYPE = 4
        NO_AUTHORITY = 5
        UNKNOWN_ERROR = 6
        HEADER_NOT_ALLOWED = 7
        SEPARATOR_NOT_ALLOWED = 8
        FILESIZE_NOT_ALLOWED = 9
. " GUI_DOWNLOAD




ABAP code using 7.40 inline data declarations to call FM GUI_DOWNLOAD

The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.

 
 
 
 
DATA(ld_col_select_mask) = ' '.
 
 
DATA(ld_dat_mode) = ' '.
 
 
 
DATA(ld_confirm_overwrite) = ' '.
 
DATA(ld_no_auth_check) = ' '.
 
 
DATA(ld_codepage) = ' '.
 
 
DATA(ld_ignore_cerr) = ABAP_TRUE.
 
 
DATA(ld_replacement) = '#'.
 
 
 
DATA(ld_write_bom) = ' '.
 
 
DATA(ld_trunc_trailing_blanks_eol) = 'X'.
 
DATA(ld_wk1_n_format) = ' '.
 
 
 
 
 
DATA(ld_wk1_n_size) = ' '.
 
 
DATA(ld_wk1_t_format) = ' '.
 
 
DATA(ld_wk1_t_size) = ' '.
 
DATA(ld_write_lf_after_last_line) = ABAP_TRUE.
 
DATA(ld_show_transfer_status) = ABAP_TRUE.
 
DATA(ld_virus_scan_profile) = '/SCET/GUI_DOWNLOAD'.
 
DATA(ld_filetype) = 'ASC'.
 
 
DATA(ld_append) = ' '.
 
 
 
DATA(ld_write_field_separator) = ' '.
 
DATA(ld_header) = '00'.
 
 
 
DATA(ld_trunc_trailing_blanks) = ' '.
 
DATA(ld_write_lf) = 'X'.
 
 
DATA(ld_col_select) = ' '.
 
 


Search for further information about these or an SAP related objects



Comments on this SAP object

What made you want to lookup this SAP object? Please tell us what you were looking for and anything you would like to be included on this page!