Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

UPLOAD and DOWNLOAD

Former Member
0 Kudos

Hi All,

I am in Upgrade project. I have to replace the following Obsolete FM with Cl_GUI_FRONTEND_SERVICES.

How to do that? Any code would be highly appriciated.

CALL FUNCTION 'UPLOAD'

EXPORTING

codepage = 'IBM'

filetype = 'BIN'

filetype_no_change = 'X'

filetype_no_show = 'X'

IMPORTING

cancel = return

TABLES

data_tab = pool

EXCEPTIONS

conversion_error = 1

invalid_table_width = 2

invalid_type = 3

no_batch = 4

unknown_error = 5

gui_refuse_filetransfer = 6

OTHERS = 7.

-


CALL FUNCTION 'DOWNLOAD'

EXPORTING

bin_filesize = len

codepage = 'IBM'

filetype = 'BIN'

filetype_no_change = 'X'

filetype_no_show = 'X'

IMPORTING

act_filename = act_fn

TABLES

data_tab = pool

EXCEPTIONS

invalid_filesize = 1

invalid_table_width = 2

invalid_type = 3

no_batch = 4

unknown_error = 5

gui_refuse_filetransfer = 6

OTHERS = 7.

For teh above TWo FM what could be the solution ??

Thanks in advance

RK

5 REPLIES 5

Former Member
0 Kudos

Hi,

Use GUI_DOWNLOAD & GUI_UPLOAD Methods.

Regards,

Satish

former_member195698
Active Contributor
0 Kudos

See this links. it might be helpful

regards,

abhishek

reward if useful

Former Member
0 Kudos

Hi RK,

Use FM GUI_DOWNLOAD & GUI_UPLOAD instead of that.

If it is usefull pls reward.

Regards

Srimanta

Pawan_Kesari
Active Contributor
0 Kudos

CALL METHOD cl_gui_frontend_services=>gui_upload
  EXPORTING
    filename                = p_filname
    filetype                = 'BIN'
    codepage                = 'IBM'
  CHANGING
    data_tab                = pool
  EXCEPTIONS
    file_open_error         = 1
    file_read_error         = 2
    no_batch                = 3
    gui_refuse_filetransfer = 4
    invalid_type            = 5
    no_authority            = 6
    unknown_error           = 7
    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
    not_supported_by_gui    = 17
    error_no_gui            = 18
    OTHERS                  = 19.

IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
             WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

CALL METHOD cl_gui_frontend_services=>gui_download
  EXPORTING
    bin_filesize            = len
    filename                = p_filename
    filetype                = 'BIN'
  CHANGING
    data_tab                = pool
  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
    not_supported_by_gui    = 22
    error_no_gui            = 23
    OTHERS                  = 24.

IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
             WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

varma_narayana
Active Contributor
0 Kudos

Hi...

You have to call the Static methods of the Class: Cl_GUI_FRONTEND_SERVICES.

for UPLOAD:

call Method Cl_GUI_FRONTEND_SERVICES=>GUI_UPLOAD

for DOWNLOAD:

call Method Cl_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD

You can open this Class Cl_GUI_FRONTEND_SERVICES in Class builder SE24 and find these methods.

<b>REWARD IF HELPFUL.</b>