cancel
Showing results for 
Search instead for 
Did you mean: 

HOW TO DOWNLOAD CSV FORMAT FILE TO PC AND APPLICATION SERVER

Former Member
0 Kudos
4,236

HI EXPERTS,

HOW TO DOWNLOAD CSV FORMAT FILE TO PC AND APPLICATION SERVER

POINTS WILL BE REWARDED..

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Dear Rakesh,

This has been asnwered in one of your earlier threads:

<b>Do not duplicate threads, close the thread if your query is resolved or update the same if you need further information. Do remember to reward all helpful answers.</b>

go through this link...

type-pools:TRUXS.

data: begin of itab occurs 0,

vbeln like vbap-vbeln,

posnr like vbap-posnr,

end of itab.

data: itab1 type TRUXS_T_TEXT_DATA.

select vbeln posnr up to 10 rows from vbap into table itab.

CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'

EXPORTING

I_FIELD_SEPERATOR = ','

TABLES

I_TAB_SAP_DATA = itab

CHANGING

I_TAB_CONVERTED_DATA = itab1

EXCEPTIONS

CONVERSION_FAILED = 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.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING filename = 'C:\TEMP\test.TXT'

TABLES data_tab = itab1

EXCEPTIONS

OTHERS = 1.

It has all possible ways.

Hope this will help.

Regards,

Naveen.

amit_khare
Active Contributor
0 Kudos

For Downloading to PC use GUI_DOWNLOAD.

For downloading to application server use OPEN DATASET.

Refer the link -

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

Regards,

Amit

Reward all helpful replies.

Former Member
0 Kudos

Hi Rakesh, use this function

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE =

filename = fullpath

filetype = 'ASC'

  • APPEND = ' '

  • write_field_separator = ';'

  • HEADER = '00'

  • TRUNC_TRAILING_BLANKS = ' '

  • WRITE_LF = 'X'

  • COL_SELECT = ' '

  • COL_SELECT_MASK = ' '

  • DAT_MODE = ' '

  • CONFIRM_OVERWRITE = ' '

  • NO_AUTH_CHECK = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • WRITE_BOM = ' '

  • TRUNC_TRAILING_BLANKS_EOL = 'X'

  • WK1_N_FORMAT = ' '

  • WK1_N_SIZE = ' '

  • WK1_T_FORMAT = ' '

  • WK1_T_SIZE = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

data_tab = l_iout (Internal Table containing extracted data)

  • FIELDNAMES =

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

.

IF sy-subrc <> 0.

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

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

ENDIF.

ENDIF.

ENDFORM. " download