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: 

DOWNLOADING FILE

Former Member
0 Kudos

hi alll

in my selection screen i will specify the file and in my program i should download the file to the internal table can any one send me the function module and logic to do that,

Thanks,

Kalyan

8 REPLIES 8

Former Member
0 Kudos

GUI_DOWNLOAD if the file is on presentation server.

otherswise use datasets for the same.

bbye tac care

Ashwani

Former Member
0 Kudos

Hi,

For uploading the file from presentation server to internal table you can use GUI_UPLOAD FM..

For downloading from internal table to presentation server file you can use GUI_DOWNLOAD FM.

Ex

DATA: t_string TYPE string OCCURS 0 WITH HEADER LINE.

PARAMETERS: p_file TYPE rlgrap-filename.

DATA: v_string TYPE string.

v_string = p_file.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = v_string

TABLES

data_tab = t_string

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.

IF sy-subrc <> 0.

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

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

ENDIF.

Thanks,

Naren

Former Member
0 Kudos

Hi,

Check the following code:

DATA: i_file like rlgrap-filename value '/usr/sap/tmp/file.txt'.

OPEN DATASET i_file FOR INPUT IN TEXT MODE.

IF sy-subrc NE 0.

MESSAGE e999(za) WITH 'Error opening file' i_file.

ENDIF.

DO.

  • Reads each line of file individually

READ DATASET i_file INTO wa_datatab.

  • Perform processing here

  • .....

ENDDO.

Hope this helps.

Reward if helpful.

Regards,

Sipra

Former Member
0 Kudos

Refer this link

http://www.sapdevelopment.co.uk/file/file_updown.htm

Reward poinst if this helps.

Former Member
0 Kudos

Hi,

PARAMETERS:P_FNAME LIKE RLGRAP-FILENAME DEFAULT 'E:\TEMP\.TXT' MODIF ID XYZ.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

FILENAME = P_FNAME

FILETYPE = 'DAT'

TABLES

DATA_TAB = IT_OUT

EXCEPTIONS

CONVERSION_ERROR = 1

FILE_OPEN_ERROR = 2

FILE_READ_ERROR = 3

INVALID_TYPE = 4

NO_BATCH = 5

UNKNOWN_ERROR = 6

INVALID_TABLE_WIDTH = 7

GUI_REFUSE_FILETRANSFER = 8

CUSTOMER_ERROR = 9

NO_AUTHORITY = 10

OTHERS = 11.

IF SY-SUBRC <> 0.

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

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

MESSAGE E002(Z1).

ENDIF.

if ur prob solved pls reward me..

Former Member
0 Kudos

hi siri,

you should use XXL (for download in excel)for this, this is latest in this case.

rgds

Deepak.

Message was edited by:

Deepak Rana

Former Member
0 Kudos

Hi,

call function 'UPLOAD'

exporting

filename = 'C:\Ztest.TXT'

filetype = 'DAT'

tables

data_tab = raw_table

exceptions

conversion_error = 1

invalid_table_width = 2

invalid_type = 3

no_batch = 4

unknown_error = 5

gui_refuse_filetransfer = 6

others = 7.

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

From file to internal table,use GUI_UPLOAD function module.

Check this link.

http://www.sapdevelopment.co.uk/file/file_uptabpc.htm

Form internal table to file,use GUI_DOWNLOAD fucntion module.

Check this link.

http://erpgenie.com/abaptips/content/view/164/61/