SAP Function Modules

GUI_UPLOAD SAP Function module - Upload for Data Provider








GUI_UPLOADis a standard SAP function module available within R/3 SAPsystems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import/export parameters, exceptions etc as well as any documentation contributions specific to the object. See here to view full function module documentation and code listing, simply by entering the name GUI_UPLOAD into the relevant SAP transaction such as SE37 or SE80.

Contribute (Add Comments)
Please help keep this info upto date and use the comments section below to add useful hints, tips and information specific to this SAP function. This will then be available for you and other users to easily find by simply searching on the object name GUI_UPLOAD or its description.


Pattern for FM GUI_UPLOAD - GUI UPLOAD
Associated Function Group: SFES
Released Date: 23.03.2001
CALL FUNCTION 'GUI_UPLOAD' "Upload for Data Provider
  EXPORTING
    filename =                  " string        Name of file
*   filetype = 'ASC'            " char10        File Type (ASC or BIN)
*   has_field_separator = SPACE  " char01       Columns Separated by Tabs in Case of ASCII Upload
*   header_length = 0           " i             Length of Header for Binary Data
*   read_by_line = 'X'          " char01        The file will be written to the internal table line-by-line
*   dat_mode = SPACE            " char01        Numeric and Date Fields Imported in ws_download 'DAT' Format
*   codepage = SPACE            " abap_encoding  Character Representation for Output
*   ignore_cerr = ABAP_TRUE     " abap_bool     Specifies whether to ignore errors converting character sets
*   replacement = '#'           " abap_repl     Replacement Character for Non-Convertible Characters
*   check_bom = SPACE           " char01        The consistency of the codepage and byte order mark will be checked
*   virus_scan_profile =        " vscan_profile  Virus Scan Profile
*   no_auth_check = SPACE       " char01        Switch off Check for Access Rights
  IMPORTING
    filelength =                " i             File Length
    header =                    " xstring       File Header in Case of Binary Upload
  TABLES
    data_tab =                  "               Transfer table for file contents
* CHANGING
*   isscanperformed = SPACE     " char01        File already scanned
  EXCEPTIONS
    FILE_OPEN_ERROR = 1         "               File does not exist and cannot be opened
    FILE_READ_ERROR = 2         "               Error when reading file
    NO_BATCH = 3                "               Cannot execute front-end function in background
    GUI_REFUSE_FILETRANSFER = 4  "              Incorrect front end or error on front end
    INVALID_TYPE = 5            "               Incorrect parameter FILETYPE
    NO_AUTHORITY = 6            "               No Authorization for Upload
    BAD_DATA_FORMAT = 8         "               Cannot Interpret Data in File
    HEADER_NOT_ALLOWED = 9      "               Invalid header
    SEPARATOR_NOT_ALLOWED = 10  "               Invalid separator
    HEADER_TOO_LONG = 11        "               The header information is limited to 1023 bytes at present
    UNKNOWN_DP_ERROR = 12       "               Error when calling data provider
    ACCESS_DENIED = 13          "               Access to File Denied
    DP_OUT_OF_MEMORY = 14       "               Not Enough Memory in Data Provider
    DISK_FULL = 15              "               Storage Medium full
    DP_TIMEOUT = 16             "               Timeout of Data Provider
    .  "  GUI_UPLOAD

ABAP code example for GUI_UPLOAD Function Module

The ABAP code below is a full code listing to execute function module GUI_UPLOAD including all data declarations. The code uses the latest IN-LINE DATA DECLARATION SYNTAX but I have included an ABAP code snipet at the end to show how declarations would look using the original method of declaring data variables up front. 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).
DATA:
ld_filelength TYPE I,
ld_header TYPE XSTRING,
it_data_tab TYPE STANDARD TABLE OF STRING,"TABLES PARAM
wa_data_tab LIKE LINE OF it_data_tab.

DATA(ld_isscanperformed) = 'Check type of data required'.
DATA(ld_filename) = 'Check type of data required'.
DATA(ld_filetype) = 'Check type of data required'.
DATA(ld_has_field_separator) = 'Check type of data required'.
DATA(ld_header_length) = 'Check type of data required'.
DATA(ld_read_by_line) = 'Check type of data required'.
DATA(ld_dat_mode) = 'Check type of data required'.
DATA(ld_codepage) = 'Check type of data required'.
DATA(ld_ignore_cerr) = 'Check type of data required'.
DATA(ld_replacement) = 'Check type of data required'.
DATA(ld_check_bom) = 'Check type of data required'.
DATA(ld_virus_scan_profile) = 'Check type of data required'.
DATA(ld_no_auth_check) = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_data_tab to it_data_tab.. CALL FUNCTION 'GUI_UPLOAD' EXPORTING filename = ld_filename * filetype = ld_filetype * has_field_separator = ld_has_field_separator * header_length = ld_header_length * read_by_line = ld_read_by_line * dat_mode = ld_dat_mode * codepage = ld_codepage * ignore_cerr = ld_ignore_cerr * replacement = ld_replacement * check_bom = ld_check_bom * virus_scan_profile = ld_virus_scan_profile * no_auth_check = ld_no_auth_check IMPORTING filelength = ld_filelength header = ld_header TABLES data_tab = it_data_tab * CHANGING * isscanperformed = ld_isscanperformed EXCEPTIONS FILE_OPEN_ERROR = 1 FILE_READ_ERROR = 2 NO_BATCH = 3 GUI_REFUSE_FILETRANSFER = 4 INVALID_TYPE = 5 NO_AUTHORITY = 6 BAD_DATA_FORMAT = 8 HEADER_NOT_ALLOWED = 9 SEPARATOR_NOT_ALLOWED = 10 HEADER_TOO_LONG = 11 UNKNOWN_DP_ERROR = 12 ACCESS_DENIED = 13 DP_OUT_OF_MEMORY = 14 DISK_FULL = 15 DP_TIMEOUT = 16 . " GUI_UPLOAD
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 2. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 3. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 4. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 5. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 6. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 8. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 9. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 10. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 11. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 12. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 13. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 14. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 15. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 16. "Exception "Add code for exception here ENDIF.

ABAP code to compare 7.40 inline data declaration with original syntax

The below ABAP code uses the older none in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. It may also be useful if you are using an older version of SAP as some of the newer syntax above, such as the @DATA is not available until 4.70 EHP 8.
DATA:
it_data_tab TYPE STANDARD TABLE OF STRING ,
wa_data_tab LIKE LINE OF it_data_tab,
ld_filename TYPE STRING ,
ld_isscanperformed TYPE CHAR01 ,
ld_filelength TYPE I ,
ld_header TYPE XSTRING ,
ld_filetype TYPE CHAR10 ,
ld_has_field_separator TYPE CHAR01 ,
ld_header_length TYPE I ,
ld_read_by_line TYPE CHAR01 ,
ld_dat_mode TYPE CHAR01 ,
ld_codepage TYPE ABAP_ENCODING ,
ld_ignore_cerr TYPE ABAP_BOOL ,
ld_replacement TYPE ABAP_REPL ,
ld_check_bom TYPE CHAR01 ,
ld_virus_scan_profile TYPE VSCAN_PROFILE ,
ld_no_auth_check TYPE CHAR01 .


"populate fields of struture and append to itab
append wa_data_tab to it_data_tab.
ld_filename = 'Check type of data required'.
ld_isscanperformed = 'Check type of data required'.
ld_filetype = 'Check type of data required'.
ld_has_field_separator = 'Check type of data required'.
ld_header_length = 'Check type of data required'.
ld_read_by_line = 'Check type of data required'.
ld_dat_mode = 'Check type of data required'.
ld_codepage = 'Check type of data required'.
ld_ignore_cerr = 'Check type of data required'.
ld_replacement = 'Check type of data required'.
ld_check_bom = 'Check type of data required'.
ld_virus_scan_profile = 'Check type of data required'.
ld_no_auth_check = 'Check type of data required'..

SAP Documentation for FM GUI_UPLOAD


The module loads a file from the PC to the server. Data can be transferred binarily or as text. Numbers and date fields can be ...See here for full SAP fm documentation