Skip to Content
avatar image
Former Member

GUI_DOWNLOAD and UPLOAD Function Modules?

Hi All,

What exactly done by GUI_DOWNLOAD and UPLOAD Function Modules?

Akshitha.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Feb 27, 2008 at 02:10 PM

    Hi Akshitha

    GUI_DOWNLOAD: Record a file from an internal table

    GUI_UPLOAD: Upload a file to an internal table.

    Regards,

    mgg

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 27, 2008 at 02:11 PM

    What you exactly want know?

    Here is the Sap documentation for both FM:

    FU GUI_UPLOAD

    ____________________________________________________

    Short Text

    Upload for Data Provider

    Functionality

    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 interpreted according to the user settings.

    Example

    Binary upload: No conversion or interpretation

    begin of itab,

    raw(255) type x,

    end of itab occurs 0.

    CALL FUNCTION 'GUI_UPLOAD'

    exporting

    filetype = 'BIN'

    filename = 'C:\DOWNLOAD.BIN'

    tables

    data_tab = itab.

    Text upload

    begin of itab,

    text(255) type c,

    end of itab occurs 0.

    CALL FUNCTION 'GUI_UPLOAD'

    exporting

    filetype = 'ASC'

    filename = 'C:\DOWNLOAD.TXT'

    tables

    data_tab = itab.

    Parameters

    FILENAME

    FILETYPE

    HAS_FIELD_SEPARATOR

    HEADER_LENGTH

    READ_BY_LINE

    DAT_MODE

    CODEPAGE

    IGNORE_CERR

    REPLACEMENT

    CHECK_BOM

    VIRUS_SCAN_PROFILE

    NO_AUTH_CHECK

    FILELENGTH

    HEADER

    DATA_TAB

    Exceptions

    FILE_OPEN_ERROR

    FILE_READ_ERROR

    NO_BATCH

    GUI_REFUSE_FILETRANSFER

    INVALID_TYPE

    NO_AUTHORITY

    UNKNOWN_ERROR

    BAD_DATA_FORMAT

    HEADER_NOT_ALLOWED

    SEPARATOR_NOT_ALLOWED

    HEADER_TOO_LONG

    UNKNOWN_DP_ERROR

    ACCESS_DENIED

    DP_OUT_OF_MEMORY

    DISK_FULL

    DP_TIMEOUT

    Function Group

    SFES

    FU GUI_DOWNLOAD

    ____________________________________________________

    Short Text

    Download an Internal Table to the PC

    Functionality

    Data transfer of an internal table form the server to a file on the PC. The Gui_Download module replaces the obsolete modules Ws_Download and Download. The file dialog of the download module is available in the class Cl_Gui_Frontend_Services.

    Further information

    TYPE-POOLS: ABAP.

    • Binary download table

    DATA: BEGIN OF line_bin,

    data(1024) TYPE X,

    END OF line_bin.

    DATA: data_tab_bin LIKE STANDARD TABLE OF line_bin.

    • Ascii download table

    DATA: BEGIN OF line_asc,

    text(1024) TYPE C,

    END OF line_asc.

    DATA: data_tab_asc LIKE STANDARD TABLE OF line_asc.

    • DAT download table

    DATA: BEGIN OF line_dat,

    Packed TYPE P,

    Text(10) TYPE C,

    Number TYPE I,

    Date TYPE D,

    Time TYPE T,

    Float TYPE F,

    Hex(3) TYPE X,

    String TYPE String,

    END OF line_dat.

    DATA: data_tab_dat LIKE STANDARD TABLE OF line_dat.

    • Get filename

    DATA: fullpath TYPE String,

    filename TYPE String,

    path TYPE String,

    user_action TYPE I,

    encoding TYPE ABAP_ENCODING.

    CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG

    EXPORTING

    WINDOW_TITLE = 'Gui_Download Demo'

    WITH_ENCODING = 'X'

    INITIAL_DIRECTORY = 'C:\'

    CHANGING

    FILENAME = filename

    PATH = path

    FULLPATH = fullpath

    USER_ACTION = user_action

    FILE_ENCODING = encoding

    EXCEPTIONS

    CNTL_ERROR = 1

    ERROR_NO_GUI = 2

    NOT_SUPPORTED_BY_GUI = 3

    others = 4.

    IF SY-SUBRC <> 0.

    EXIT.

    ENDIF.

    IF user_action <> CL_GUI_FRONTEND_SERVICES=>ACTION_OK.

    EXIT.

    ENDIF.

    • Download variables

    DATA: length TYPE I.

    • Binary download

    CALL FUNCTION 'GUI_DOWNLOAD'

    EXPORTING

    FILENAME = fullpath

    FILETYPE = 'BIN'

    IMPORTING

    FILELENGTH = length

    TABLES

    DATA_TAB = data_tab_bin

    EXCEPTIONS

    FILE_WRITE_ERROR = 1

    NO_BATCH = 2

    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

    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

    DATAPROVIDER_EXCEPTION = 20

    CONTROL_FLUSH_ERROR = 21

    OTHERS = 22.

    • Ascii download

    CALL FUNCTION 'GUI_DOWNLOAD'

    EXPORTING

    FILENAME = fullpath

    FILETYPE = 'ASC'

    IMPORTING

    FILELENGTH = length

    TABLES

    DATA_TAB = data_tab_asc

    EXCEPTIONS

    FILE_WRITE_ERROR = 1

    NO_BATCH = 2

    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

    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

    DATAPROVIDER_EXCEPTION = 20

    CONTROL_FLUSH_ERROR = 21

    OTHERS = 22.

    • DAT download

    CALL FUNCTION 'GUI_DOWNLOAD'

    EXPORTING

    FILENAME = fullpath

    FILETYPE = 'DAT'

    IMPORTING

    FILELENGTH = length

    TABLES

    DATA_TAB = data_tab_dat

    EXCEPTIONS

    FILE_WRITE_ERROR = 1

    NO_BATCH = 2

    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

    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

    DATAPROVIDER_EXCEPTION = 20

    CONTROL_FLUSH_ERROR = 21

    OTHERS = 22.

    Parameters

    BIN_FILESIZE

    FILENAME

    FILETYPE

    APPEND

    WRITE_FIELD_SEPARATOR

    HEADER

    TRUNC_TRAILING_BLANKS

    WRITE_LF

    COL_SELECT

    COL_SELECT_MASK

    DAT_MODE

    CONFIRM_OVERWRITE

    NO_AUTH_CHECK

    CODEPAGE

    IGNORE_CERR

    REPLACEMENT

    WRITE_BOM

    TRUNC_TRAILING_BLANKS_EOL

    WK1_N_FORMAT

    WK1_N_SIZE

    WK1_T_FORMAT

    WK1_T_SIZE

    WRITE_EOL

    FILELENGTH

    DATA_TAB

    FIELDNAMES

    Exceptions

    FILE_WRITE_ERROR

    NO_BATCH

    GUI_REFUSE_FILETRANSFER

    INVALID_TYPE

    NO_AUTHORITY

    UNKNOWN_ERROR

    HEADER_NOT_ALLOWED

    SEPARATOR_NOT_ALLOWED

    FILESIZE_NOT_ALLOWED

    HEADER_TOO_LONG

    DP_ERROR_CREATE

    DP_ERROR_SEND

    DP_ERROR_WRITE

    UNKNOWN_DP_ERROR

    ACCESS_DENIED

    DP_OUT_OF_MEMORY

    DISK_FULL

    DP_TIMEOUT

    FILE_NOT_FOUND

    DATAPROVIDER_EXCEPTION

    CONTROL_FLUSH_ERROR

    Function Group

    SFES

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 27, 2008 at 02:20 PM

    In short,

    GUI_UPLOAD - uploads a file from your desktop or laptop into an ABAP internal table within your program - you can then use that data for your program's needs

    GUI_DOWNLOAD - downloads an internal table from your ABAP program into a file on your desktop or laptop

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 27, 2008 at 02:52 PM

    hi

    good

    Please note that function download/upload come with user interaction

    (popup to ask for a filename). The new functions or methods don't do

    that. You first have to execute another method from

    cl_gui_frontend_services to call for this.

    thanks

    mrutyun^

    Add comment
    10|10000 characters needed characters exceeded