Application Development and Automation 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: 
Read only

diff between gui_upload &? ws_upload

Former Member
0 Likes
1,915

can any one tell me what is the difference between gui_upload and ws_upload.

7 REPLIES 7
Read only

JoffyJohn
Active Contributor
0 Likes
1,305

gui_upload function 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.

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.

WS_UPLOAD function module is now obsolete

Read only

JoffyJohn
Active Contributor
0 Likes
1,305

ws_upload is used for

Transfer Presentation Server File to Internal Table

Uploads a file from the presentation server into an internal table.

Read only

Former Member
0 Likes
1,305

hi harish

ws_upload is no longer used.

the usage of the other function ie ' gui_upload ' has been already posted to u.

regards

niharika

Read only

Former Member
0 Likes
1,305

Hi harish

WS_UPLOAD function module is now obsolete

from 4.7 ,gui_upload is used., this supports OOPs.

check this

WS_UPLOAD and WS_DOWNLOAD, the function modules used until now are not part of the standard set of ABAP commands. They are used to display the file interface on the presentation server. WS_UPLOAD and WS_DOWNLOAD are not compatible with USs and have been replaced by GUI_UPLOAD and GUI_DOWNLOAD.

The new function modules, GUI_UPLOAD and GUI_DOWNLOAD, have an interface that also allows you to write Unicode format to the local hard drive.

Instead of using the function modules, you can use the static methods GUI_UPLOAD and GUI_DOWNLOAD of the global class CL_GUI_FRONTEND_SERVICES.

These classes are used to convert ABAP data from the system format to external formats and vice versa. During this conversion process, character-type data may be converted to another character set, while numeric-type data may be converted to another byte order (or endian format). You must use a container of type X or XSTRING for data in an external format.

Character sets and endian formats are also converted by the file interface (OPEN DATASET with new additions), RFCs, and the function modules GUI_DOWNLOAD and GUI_UPLOAD. The classes described below are available for those special cases where the possibilities offered by conversion are insufficient. Since these classes work with containers of types X and XSTRING, these containers can be copied unconverted by the file interface (OPEN DATASET with new additions), RFCs, and the function modules GUI_DOWNLOAD and GUI_UPLOAD. These classes replace the following two statements:

TRANSLATE c ...FROM CODE PAGE g1 ... TO CODE PAGE g2

TRANSLATE f ...FROM NUMBER FORMAT n1 ... TO NUMBER FORMAT n2

For a detailed description, see the class documentation in the Class Builder. The following classes are available:

CL_ABAP_CONV_IN_CE

Reads data from a container and converts it to the system format. You can also fill structures with data.

CL_ABAP_CONV_OUT_CE

Converts data from the system format to an external format and writes it to a container.

CL_ABAP_CONV_X2X_CE

Converts data from one external format to another.

These classes are used to convert ABAP data from the system format to external formats and vice versa. During this conversion process, character-type data may be converted to another character set, while numeric-type data may be converted to another byte order (or endian format). You must use a container of type X or XSTRING for data in an external format.

Character sets and endian formats are also converted by the file interface (OPEN DATASET with new additions), RFCs, and the function modules GUI_DOWNLOAD and GUI_UPLOAD. The classes described below are available for those special cases where the possibilities offered by conversion are insufficient. Since these classes work with containers of types X and XSTRING, these containers can be copied unconverted by the file interface (OPEN DATASET with new additions), RFCs, and the function modules GUI_DOWNLOAD and GUI_UPLOAD. These classes replace the following two statements:

TRANSLATE c ...FROM CODE PAGE g1 ... TO CODE PAGE g2

TRANSLATE f ...FROM NUMBER FORMAT n1 ... TO NUMBER FORMAT n2

For a detailed description, see the class documentation in the Class Builder. The following classes are available:

CL_ABAP_CONV_IN_CE

Reads data from a container and converts it to the system format. You can also fill structures with data.

CL_ABAP_CONV_OUT_CE

Converts data from the system format to an external format and writes it to a container.

CL_ABAP_CONV_X2X_CE

Converts data from one external format to another.

************************************************************************

  • Minimal demo report for Virus Scan Interface.

  • For a functionally more complete example see report RSVSCANTEST.

************************************************************************

REPORT zvscandemo.

************************************************************************

  • Selection screen

************************************************************************

PARAMETERS:

profile TYPE vscan_prof-profile,

file TYPE localfile.

************************************************************************

  • Events

************************************************************************

AT SELECTION-SCREEN ON VALUE-REQUEST FOR file.

PERFORM file_f4.

START-OF-SELECTION.

PERFORM main.

************************************************************************

  • Main program

************************************************************************

FORM main.

IF file IS INITIAL.

MESSAGE s058(vscan) DISPLAY LIKE 'E'.

EXIT. " =================== EXIT =====================

ENDIF.

  • Access file and create XSTRING

TYPES:

ty_xline(1024) TYPE x.

DATA:

lf_file TYPE string,

lf_filelength TYPE i,

lt_datatab TYPE STANDARD TABLE OF ty_xline.

lf_file = file.

CALL METHOD cl_gui_frontend_services=>gui_upload

EXPORTING

filename = lf_file

filetype = 'BIN'

IMPORTING

filelength = lf_filelength

CHANGING

data_tab = lt_datatab

EXCEPTIONS

OTHERS = 1.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno

DISPLAY LIKE 'E'

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

EXIT. " =================== EXIT =====================

ENDIF.

  • Recombine binary data

DATA:

lf_tabline TYPE ty_xline,

lf_data TYPE xstring.

LOOP AT lt_datatab INTO lf_tabline.

CONCATENATE

lf_data

lf_tabline

INTO

lf_data

IN BYTE MODE.

ENDLOOP.

lf_data = lf_data(lf_filelength).

  • Get scanner instance

DATA:

lo_vsi TYPE REF TO cl_vsi.

CALL METHOD cl_vsi=>get_instance

EXPORTING

if_profile = profile

IMPORTING

eo_instance = lo_vsi

EXCEPTIONS

configuration_error = 1

profile_not_active = 2

internal_error = 3

OTHERS = 4.

CASE sy-subrc.

  • No error.

WHEN 0.

" Nothing to do

  • Profile not active. For this report, this is an information message.

WHEN 2.

MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno

DISPLAY LIKE 'I'

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

EXIT. " =================== EXIT =====================

  • All other exceptions are issued as errors.

WHEN OTHERS.

MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno

DISPLAY LIKE 'E'

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

EXIT. " =================== EXIT =====================

ENDCASE.

  • Perform virus scan

DATA:

lf_scanrc TYPE vscan_scanrc.

CALL METHOD lo_vsi->scan_bytes

EXPORTING

if_data = lf_data

IMPORTING

ef_scanrc = lf_scanrc

EXCEPTIONS

not_available = 1

configuration_error = 2

internal_error = 3

OTHERS = 4.

  • All exceptions here are errors

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno

DISPLAY LIKE 'E'

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

EXIT. " =================== EXIT =====================

ENDIF.

  • Print return code and text

DATA:

lf_text TYPE string.

lf_text = cl_vsi=>get_scanrc_text( lf_scanrc ).

WRITE: / 'Result of virus scan: ', lf_scanrc, '(', lf_text, ')'.

IF lf_scanrc = cl_vsi=>con_scanrc_ok.

WRITE: / 'File is clean'.

ELSE.

WRITE: / 'File was either infected',

'or could not be scanned',

'or was ignored'.

'Or another problem occurred'.

ENDIF.

ENDFORM.

************************************************************************

  • F4-help for filename

************************************************************************

FORM file_f4.

DATA:

lt_filetable TYPE filetable,

lf_rc TYPE i.

CALL METHOD cl_gui_frontend_services=>file_open_dialog

EXPORTING

multiselection = abap_false

CHANGING

file_table = lt_filetable

rc = lf_rc

EXCEPTIONS

file_open_dialog_failed = 1

cntl_error = 2

error_no_gui = 3

not_supported_by_gui = 4

OTHERS = 5.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno

DISPLAY LIKE 'E'

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

EXIT.

ENDIF.

  • Number of selected filed must be equal to one.

CHECK lf_rc = 1.

  • Access selected file

DATA:

ls_file TYPE file_table.

READ TABLE lt_filetable INTO ls_file INDEX 1.

CHECK sy-subrc = 0.

file = ls_file-filename.

ENDFORM.

Read only

Former Member
0 Likes
1,305

hi,

refer to this link it may be useful:

http://help.sap.com/saphelp_erp2005/helpdata/en/79/c554a3b3dc11d5993800508b6b8b11/frameset.htm

reward if useful,

thanks and regards.

Read only

Former Member
0 Likes
1,305

hi,

GUI_UPLOAD Replaces WS_UPLOAD. Upoad file from presentation server to the app server .

WS_UPLOAD Load Files from the Presentation Server to Internal ABAP Tables .

regards,

Rajyalakshmi

Read only

Former Member
0 Likes
1,305

hi there....

gui_upload function 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.

ws_upload is obsolete now.... so no need to go in the details of this//////

And kindly close the qstn as many similar replies are coming without any need.

Do reward and kindly close the qstn.