SAP UPLOAD Function Module for OBSOLETE: Transfer Presentation Server File to Internal Table with Length
UPLOAD is a standard upload 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: Transfer Presentation Server File to Internal Table with 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 upload FM, simply by entering the name UPLOAD 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 UPLOAD 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 'UPLOAD'"OBSOLETE: Transfer Presentation Server File to Internal Table with Length.
EXPORTING
* CODEPAGE = ' ' "Code page during ASC upload
* LINE_EXIT = ' ' "INTERNAL USE ONLY
* USER_FORM = ' ' "INTERNAL USE ONLY
* USER_PROG = ' ' "INTERNAL USE ONLY
* SILENT = 'S' "'x' suppresses the success screen
* FILENAME = ' ' "Default value for file name
* FILETYPE = ' ' "Default value for file type (ASCII, binary )
* ITEM = ' ' "Text for upload pop-up
* 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 as under FM 'WS_FILENAME_GET'
* FILETYPE_NO_SHOW = ' ' "'x' prevents displaying the file format
IMPORTING
FILESIZE = "File length (return)
CANCEL = "Is set on 'cancel'
ACT_FILENAME = "Name of the file (entered value)
ACT_FILETYPE = "File type (entered value)
TABLES
DATA_TAB = "Transfer table for file contents
EXCEPTIONS
CONVERSION_ERROR = 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 UPLOAD
CODEPAGE - Code page during ASC upload
Data type:Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
LINE_EXIT - INTERNAL USE ONLY
Data type:Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
USER_FORM - INTERNAL USE ONLY
Data type:Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
USER_PROG - INTERNAL USE ONLY
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)
FILENAME - Default value for file name
Data type: RLGRAP-FILENAMEDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
FILETYPE - Default value for file type (ASCII, binary )
Data type: RLGRAP-FILETYPEDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
ITEM - Text for upload pop-up
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 as under 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 displaying the file format
Data type:Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for UPLOAD
FILESIZE - File length (return)
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)
ACT_FILENAME - Name of the file (entered value)
Data type: RLGRAP-FILENAMEOptional: No
Call by Reference: No ( called with pass by value option)
ACT_FILETYPE - File type (entered value)
Data type: RLGRAP-FILETYPEOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for UPLOAD
DATA_TAB - Transfer table for file contents
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
CONVERSION_ERROR - Data conversion error
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 - Incorrect 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 UPLOAD 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: | ||||
| lv_codepage | TYPE STRING, " SPACE | |||
| lt_data_tab | TYPE STANDARD TABLE OF STRING, " | |||
| lv_filesize | TYPE STRING, " | |||
| lv_conversion_error | TYPE STRING, " | |||
| lv_line_exit | TYPE STRING, " SPACE | |||
| lv_user_form | TYPE STRING, " SPACE | |||
| lv_user_prog | TYPE STRING, " SPACE | |||
| lv_silent | TYPE STRING, " 'S' | |||
| lv_cancel | TYPE STRING, " | |||
| lv_filename | TYPE RLGRAP-FILENAME, " SPACE | |||
| lv_invalid_table_width | TYPE RLGRAP, " | |||
| lv_filetype | TYPE RLGRAP-FILETYPE, " SPACE | |||
| lv_act_filename | TYPE RLGRAP-FILENAME, " | |||
| lv_invalid_type | TYPE RLGRAP, " | |||
| lv_item | TYPE RLGRAP, " SPACE | |||
| lv_no_batch | TYPE RLGRAP, " | |||
| lv_act_filetype | TYPE RLGRAP-FILETYPE, " | |||
| lv_filemask_mask | TYPE RLGRAP, " SPACE | |||
| lv_unknown_error | TYPE RLGRAP, " | |||
| lv_filemask_text | TYPE RLGRAP, " SPACE | |||
| lv_gui_refuse_filetransfer | TYPE RLGRAP, " | |||
| lv_filetype_no_change | TYPE RLGRAP, " SPACE | |||
| lv_filemask_all | TYPE RLGRAP, " SPACE | |||
| lv_filetype_no_show | TYPE RLGRAP. " SPACE |
|   CALL FUNCTION 'UPLOAD' "OBSOLETE: Transfer Presentation Server File to Internal Table with Length |
| EXPORTING | ||
| CODEPAGE | = lv_codepage | |
| LINE_EXIT | = lv_line_exit | |
| USER_FORM | = lv_user_form | |
| USER_PROG | = lv_user_prog | |
| SILENT | = lv_silent | |
| FILENAME | = lv_filename | |
| FILETYPE | = lv_filetype | |
| ITEM | = lv_item | |
| 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 | |
| IMPORTING | ||
| FILESIZE | = lv_filesize | |
| CANCEL | = lv_cancel | |
| ACT_FILENAME | = lv_act_filename | |
| ACT_FILETYPE | = lv_act_filetype | |
| TABLES | ||
| DATA_TAB | = lt_data_tab | |
| EXCEPTIONS | ||
| CONVERSION_ERROR = 1 | ||
| INVALID_TABLE_WIDTH = 2 | ||
| INVALID_TYPE = 3 | ||
| NO_BATCH = 4 | ||
| UNKNOWN_ERROR = 5 | ||
| GUI_REFUSE_FILETRANSFER = 6 | ||
| . " UPLOAD | ||
ABAP code using 7.40 inline data declarations to call FM UPLOAD
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_codepage) | = ' '. | |||
| DATA(ld_line_exit) | = ' '. | |||
| DATA(ld_user_form) | = ' '. | |||
| DATA(ld_user_prog) | = ' '. | |||
| DATA(ld_silent) | = 'S'. | |||
| "SELECT single FILENAME FROM RLGRAP INTO @DATA(ld_filename). | ||||
| DATA(ld_filename) | = ' '. | |||
| "SELECT single FILETYPE FROM RLGRAP INTO @DATA(ld_filetype). | ||||
| DATA(ld_filetype) | = ' '. | |||
| "SELECT single FILENAME FROM RLGRAP INTO @DATA(ld_act_filename). | ||||
| DATA(ld_item) | = ' '. | |||
| "SELECT single FILETYPE FROM RLGRAP INTO @DATA(ld_act_filetype). | ||||
| DATA(ld_filemask_mask) | = ' '. | |||
| DATA(ld_filemask_text) | = ' '. | |||
| DATA(ld_filetype_no_change) | = ' '. | |||
| DATA(ld_filemask_all) | = ' '. | |||
| DATA(ld_filetype_no_show) | = ' '. | |||
Search for further information about these or an SAP related objects