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: 

DIFFERENCE BETWEEN OPEN_DATASET AND GUI_UPLOAD

Former Member
0 Kudos

WHY WE USE OPEN_DATASET TO FETCH DATA FROM APPLICATION SERVER WHERE AS WE USE ONLY GUI_UPLOAD TO FETCH FROM PRESENTATION SERVER?

4 REPLIES 4

Former Member
0 Kudos

Mili ,

These are standard keywords so there is no question of why they r used ..!!!!

Ankesh

Former Member
0 Kudos

Hi,

It is because SAP has defined the rule to use that Function module and Keyword for that.

Former Member
0 Kudos

I think you should close the post now, a question which need not be answered is also answered....

Former Member
0 Kudos

Hi,

Open dataset is used to transfer the contents to Application server file or to read the contents from Application server

GUI_UPLOAD is used to transfer the contents from Presentation system file to internal table

GUI_DOWNLOAD is used to transfer the contents from internal table to Presentation system file

Application server file read/write:

http://help.sap.com/saphelp_nw04/Helpdata/EN/fc/eb3ca6358411d1829f0000e829fbfe/frameset.htm

http://help.sap.com/saphelp_nw04/Helpdata/EN/fc/eb3ca6358411d1829f0000e829fbfe/frameset.htm

presentation system file read/write:

Sample ABAP Program to download table using new function GUI_DOWNLOAD

&----


*& Report ZDOWNLOAD *

*& *

&----


*& This program uses the new function GUI_DOWNLOAD *

*& Output will be TAB delimited and include MANDT *

*& It can be opened directly by Microsoft Excel *

*& To use this program for any Database Table replace ZTEST with *

*& new table name. *

&----


*& AUTHOR: Sheila Titchener - abap at iconet-ltd.co.uk *

*& Date: February 2004 *

&----


REPORT zdownload MESSAGE-ID bd.

DATA: w_tab TYPE ztest.

DATA: i_tab TYPE STANDARD TABLE OF ztest.

DATA: v_subrc(2),

v_recswritten(6).

PARAMETERS: p_file(80)

DEFAULT 'D:
ICONET
SAP
ZTEST.DAT'.

DATA: filename TYPE string.

filename = p_file.

SELECT * FROM ztest INTO TABLE I_TAB.

  • If text fields appear right justified or columns not lined up in output set

  • TRUNC_TRAILING_BLANKS to X

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE =

filename = filename

  • FILETYPE = 'ASC'

  • APPEND = ' '

WRITE_FIELD_SEPARATOR = 'X'

  • HEADER = '00'

TRUNC_TRAILING_BLANKS = 'X '

  • WRITE_LF = 'X'

  • COL_SELECT = ' '

  • COL_SELECT_MASK = ' '

  • IMPORTING

  • FILELENGTH =

tables

data_tab = I_TAB

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

.

  • SYST FIELDS ARE NOT SET BY THIS FUNCTION SO DISPLAY THE ERROR CODE *

IF sy-subrc <> 0.

v_subrc = sy-subrc.

MESSAGE e899 WITH 'File Open Error' v_subrc.

ENDIF.

DESCRIBE TABLE i_tab LINES v_recswritten.

MESSAGE i899 WITH v_recswritten 'Records Written from ZTEST'.

Sample ABAP Program to Upload table using new function GUI_UPLOAD

*& Report ZUPLOAD *

*& *

&----


*& This program uses the new function GUI_UPLOAD *

*& Input must be TAB delimited with a blank column at the start *

*& to allow for MANDT. *

*& To use this program for any Database Table replace ZTEST with *

*& new table name. *

&----


*& AUTHOR: Sheila Titchener - abap at iconet-ltd.co.uk *

*& Date: February 2004 *

&----


REPORT zupload MESSAGE-ID bd.

DATA: w_tab TYPE ZTEST.

DATA: i_tab TYPE STANDARD TABLE OF ZTEST.

DATA: v_subrc(2),

v_recswritten(6).

PARAMETERS: p_file(80)

DEFAULT 'C:\Temp\ZTEST.TXT'.

DATA: filename TYPE string,

w_ans(1) TYPE c.

filename = p_file.

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

titlebar = 'Upload Confirmation'

  • DIAGNOSE_OBJECT = ' '

text_question = p_file

text_button_1 = 'Yes'(001)

  • ICON_BUTTON_1 = ' '

text_button_2 = 'No'(002)

  • ICON_BUTTON_2 = ' '

default_button = '2'

  • DISPLAY_CANCEL_BUTTON = 'X'

  • USERDEFINED_F1_HELP = ' '

  • START_COLUMN = 25

  • START_ROW = 6

  • POPUP_TYPE =

  • IV_QUICKINFO_BUTTON_1 = ' '

  • IV_QUICKINFO_BUTTON_2 = ' '

IMPORTING

answer = w_ans

  • TABLES

  • PARAMETER =

  • EXCEPTIONS

  • TEXT_NOT_FOUND = 1

  • OTHERS = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CHECK w_ans = 1.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = filename

  • FILETYPE = 'ASC

has_field_separator = 'X'

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

data_tab = i_tab

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

OTHERS = 17.

  • SYST FIELDS ARE NOT SET BY THIS FUNCTION SO DISPLAY THE ERROR CODE *

IF sy-subrc <> 0.

v_subrc = sy-subrc.

MESSAGE e899 WITH 'File Open Error' v_subrc.

ENDIF.

INSERT ZTEST FROM TABLE i_tab.

COMMIT WORK AND WAIT.

MESSAGE i899 WITH sy-dbcnt 'Records Written to ZTEST'.

Thanks,

Naveen Kumar.