SAP DOWNLOAD Function Module for OBSOLETE: Save Internal Table as Presentation Server File with File Length









DOWNLOAD is a standard 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 OBSOLETE: Save Internal Table as Presentation Server File with File Length 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 download FM, simply by entering the name DOWNLOAD into the relevant SAP transaction such as SE37 or SE38.

Function Group: GRAP
Program Name: SAPLGRAP
Main Program: SAPLGRAP
Appliation area: S
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:



Function 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 'DOWNLOAD'"OBSOLETE: Save Internal Table as Presentation Server File with File Length
EXPORTING
* BIN_FILESIZE = ' ' "File length for binary files
* WK1_T_SIZE = ' ' "Column width for text columns for files of the type WK1
* FILEMASK_MASK = ' ' "Mask for file selection (e.g., '*.txt' )
* FILEMASK_TEXT = ' ' "Mask for file selection (help text)
* FILETYPE_NO_CHANGE = ' ' "'x' prevents change to the file format
* FILEMASK_ALL = ' ' "File mask such as FM 'WS_FILENAME_GET'
* FILETYPE_NO_SHOW = ' ' "'x' prevents display of the file format
* SILENT = 'S' "'x' suppresses the success screen
* COL_SELECT = ' ' "Column selection: activate
* COL_SELECTMASK = ' ' "Column selection: masking
* NO_AUTH_CHECK = ' ' "
* CODEPAGE = ' ' "Code page for ASCII download
* FILENAME = ' ' "Name of the file (default value)
* FILETYPE = ' ' "File type (ASCII, binary, ...)(default value)
* ITEM = ' ' "Header for file dialog
* MODE = ' ' "Writing mode (overwrite, append)
* WK1_N_FORMAT = ' ' "Format for value columns in files of the type WK1
* 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

IMPORTING
ACT_FILENAME = "Name of the file (entered value)
ACT_FILETYPE = "File type (entered value)
FILESIZE = "Number of bytes transferred
CANCEL = "Is set on 'cancel'

TABLES
DATA_TAB = "Transfer table
* FIELDNAMES = "Field names for DAT file type

EXCEPTIONS
INVALID_FILESIZE = 1 INVALID_TABLE_WIDTH = 2 INVALID_TYPE = 3 NO_BATCH = 4 UNKNOWN_ERROR = 5 GUI_REFUSE_FILETRANSFER = 6
.




Customer Function user exits

Below is a list of CUSTOMER FUNCTION exit user exits that are available within this program and maybe relevant for this FM.
EXIT_SAPLGRAP_001 Customer-specific authorization check and trace for download
EXIT_SAPLGRAP_002 Customer-specific check of the upload data (for example, for viruses)

IMPORTING Parameters details for DOWNLOAD

BIN_FILESIZE - File length for binary files

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

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

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

FILEMASK_MASK - Mask for file selection (e.g., '*.txt' )

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

FILEMASK_TEXT - Mask for file selection (help text)

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

FILETYPE_NO_CHANGE - 'x' prevents change to the file format

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

FILEMASK_ALL - File mask such as FM 'WS_FILENAME_GET'

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

FILETYPE_NO_SHOW - 'x' prevents display of the file format

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

SILENT - 'x' suppresses the success screen

Data type:
Default: 'S'
Optional: Yes
Call by Reference: No ( called with pass by value option)

COL_SELECT - Column selection: activate

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

COL_SELECTMASK - Column selection: masking

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

NO_AUTH_CHECK -

Data type: C
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

CODEPAGE - Code page for ASCII download

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

FILENAME - Name of the file (default value)

Data type: RLGRAP-FILENAME
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

FILETYPE - File type (ASCII, binary, ...)(default value)

Data type: RLGRAP-FILETYPE
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

ITEM - Header for file dialog

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

MODE - Writing mode (overwrite, append)

Data type: RLGRAP-FILEMODE
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

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

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

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

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

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

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

EXPORTING Parameters details for DOWNLOAD

ACT_FILENAME - Name of the file (entered value)

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

ACT_FILETYPE - File type (entered value)

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

FILESIZE - Number of bytes transferred

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

CANCEL - Is set on 'cancel'

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

TABLES Parameters details for DOWNLOAD

DATA_TAB - Transfer table

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

FIELDNAMES - Field names for DAT file type

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

EXCEPTIONS details

INVALID_FILESIZE - Invalid parameter BIN_FILESIZE

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

INVALID_TABLE_WIDTH - Invalid table structure

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

INVALID_TYPE - Invalid value for parameter FILETYPE

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

NO_BATCH - Cannot execute front-end function in background

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

UNKNOWN_ERROR - Not Used

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

GUI_REFUSE_FILETRANSFER -

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

Copy and paste ABAP code example for 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_act_filename  TYPE RLGRAP-FILENAME, "   
lv_bin_filesize  TYPE RLGRAP, "   SPACE
lv_invalid_filesize  TYPE RLGRAP, "   
lv_wk1_t_size  TYPE RLGRAP, "   SPACE
lv_filemask_mask  TYPE RLGRAP, "   SPACE
lv_filemask_text  TYPE RLGRAP, "   SPACE
lv_filetype_no_change  TYPE RLGRAP, "   SPACE
lv_filemask_all  TYPE RLGRAP, "   SPACE
lv_filetype_no_show  TYPE RLGRAP, "   SPACE
lv_silent  TYPE RLGRAP, "   'S'
lv_col_select  TYPE RLGRAP, "   SPACE
lv_col_selectmask  TYPE RLGRAP, "   SPACE
lv_no_auth_check  TYPE C, "   SPACE
lv_codepage  TYPE C, "   SPACE
lt_fieldnames  TYPE STANDARD TABLE OF C, "   
lv_act_filetype  TYPE RLGRAP-FILETYPE, "   
lv_invalid_table_width  TYPE RLGRAP, "   
lv_filename  TYPE RLGRAP-FILENAME, "   SPACE
lv_filesize  TYPE RLGRAP, "   
lv_invalid_type  TYPE RLGRAP, "   
lv_cancel  TYPE RLGRAP, "   
lv_filetype  TYPE RLGRAP-FILETYPE, "   SPACE
lv_no_batch  TYPE RLGRAP, "   
lv_item  TYPE RLGRAP, "   SPACE
lv_unknown_error  TYPE RLGRAP, "   
lv_mode  TYPE RLGRAP-FILEMODE, "   SPACE
lv_gui_refuse_filetransfer  TYPE RLGRAP, "   
lv_wk1_n_format  TYPE RLGRAP, "   SPACE
lv_wk1_n_size  TYPE RLGRAP, "   SPACE
lv_wk1_t_format  TYPE RLGRAP. "   SPACE

  CALL FUNCTION 'DOWNLOAD'  "OBSOLETE: Save Internal Table as Presentation Server File with File Length
    EXPORTING
         BIN_FILESIZE = lv_bin_filesize
         WK1_T_SIZE = lv_wk1_t_size
         FILEMASK_MASK = lv_filemask_mask
         FILEMASK_TEXT = lv_filemask_text
         FILETYPE_NO_CHANGE = lv_filetype_no_change
         FILEMASK_ALL = lv_filemask_all
         FILETYPE_NO_SHOW = lv_filetype_no_show
         SILENT = lv_silent
         COL_SELECT = lv_col_select
         COL_SELECTMASK = lv_col_selectmask
         NO_AUTH_CHECK = lv_no_auth_check
         CODEPAGE = lv_codepage
         FILENAME = lv_filename
         FILETYPE = lv_filetype
         ITEM = lv_item
         MODE = lv_mode
         WK1_N_FORMAT = lv_wk1_n_format
         WK1_N_SIZE = lv_wk1_n_size
         WK1_T_FORMAT = lv_wk1_t_format
    IMPORTING
         ACT_FILENAME = lv_act_filename
         ACT_FILETYPE = lv_act_filetype
         FILESIZE = lv_filesize
         CANCEL = lv_cancel
    TABLES
         DATA_TAB = lt_data_tab
         FIELDNAMES = lt_fieldnames
    EXCEPTIONS
        INVALID_FILESIZE = 1
        INVALID_TABLE_WIDTH = 2
        INVALID_TYPE = 3
        NO_BATCH = 4
        UNKNOWN_ERROR = 5
        GUI_REFUSE_FILETRANSFER = 6
. " DOWNLOAD




ABAP code using 7.40 inline data declarations to call FM 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.

 
"SELECT single FILENAME FROM RLGRAP INTO @DATA(ld_act_filename).
 
DATA(ld_bin_filesize) = ' '.
 
 
DATA(ld_wk1_t_size) = ' '.
 
DATA(ld_filemask_mask) = ' '.
 
DATA(ld_filemask_text) = ' '.
 
DATA(ld_filetype_no_change) = ' '.
 
DATA(ld_filemask_all) = ' '.
 
DATA(ld_filetype_no_show) = ' '.
 
DATA(ld_silent) = 'S'.
 
DATA(ld_col_select) = ' '.
 
DATA(ld_col_selectmask) = ' '.
 
DATA(ld_no_auth_check) = ' '.
 
DATA(ld_codepage) = ' '.
 
 
"SELECT single FILETYPE FROM RLGRAP INTO @DATA(ld_act_filetype).
 
 
"SELECT single FILENAME FROM RLGRAP INTO @DATA(ld_filename).
DATA(ld_filename) = ' '.
 
 
 
 
"SELECT single FILETYPE FROM RLGRAP INTO @DATA(ld_filetype).
DATA(ld_filetype) = ' '.
 
 
DATA(ld_item) = ' '.
 
 
"SELECT single FILEMODE FROM RLGRAP INTO @DATA(ld_mode).
DATA(ld_mode) = ' '.
 
 
DATA(ld_wk1_n_format) = ' '.
 
DATA(ld_wk1_n_size) = ' '.
 
DATA(ld_wk1_t_format) = ' '.
 


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!