cancel
Showing results for 
Search instead for 
Did you mean: 

Download data into .csv format ( ABAP webDynpro )

Former Member
0 Kudos

Hi gurus ,

I am new to WebDynpro .

My requirement is that i need to download all my datas into csv format . But when i am using the function module

GUI_DOWNLOAD , an error is coming " Couldnot ascertain code page "

I have used the F.M ' SAP_CONVERT_TO_CSV_FORMAT '

call function 'SAP_CONVERT_TO_CSV_FORMAT'

exporting

i_field_seperator = ';'

  • I_LINE_HEADER =

  • I_FILENAME = ''

  • I_APPL_KEEP = ' '

tables

i_tab_sap_data = it_fail

changing

i_tab_converted_data = csv_converted_table

exceptions

conversion_failed = 1

others = 2

when i am using GUI_DOWNLOAD i am getting the above error

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = 'C:\test.csv'

tables

data_tab = csv_converted_table.

ENDIF.

suggest me or provide some sample code to download the the csv_converted_table that i got from the F.M

'SAP_CONVERT_TO_CSV_FORMAT' into .csv format to my local drive .

Thanx Gurus .

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

In WDA , you should not use 'GUI_DOWNLOAD' .

Use acfFileUpDownload

[http://www.sdn.sap.com/irj/scn/elearn?rid=/library/uuid/109b9b52-bc00-2c10-8786-e4c5e96d7e04|http://www.sdn.sap.com/irj/scn/elearn?rid=/library/uuid/109b9b52-bc00-2c10-8786-e4c5e96d7e04]

or use cl_wd_runtime_services=>attach_to_response method.

Former Member
0 Kudos

Heyy Thanks for proving a new concept ..

actually i was using the following code .

DATA : lv_filename TYPE rlgrap-filename,

lv_timestamp(55) TYPE c,

lt_csv TYPE truxs_t_text_data,

ls_csv TYPE LINE OF truxs_t_text_data,

p_path TYPE string VALUE 'D:\Result'.

Constants : lc_ex TYPE char4 VALUE '.csv'.

CONCATENATE p_path lc_ex INTO lv_timestamp.

lv_filename = lv_timestamp.

CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT'

EXPORTING

i_field_seperator = ','

i_filename = lv_filename

TABLES

i_tab_sap_data = it_fail

CHANGING

i_tab_converted_data = lt_csv

**-------Place the file in the required directory.

OPEN DATASET lv_filename FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

LOOP AT lt_csv INTO ls_csv.

TRANSFER ls_csv TO lv_filename.

ENDLOOP.

But i m getting the following error

File "D:\Result.csv" is not open.

Can u please tell me what needs to be done ...??

Thanks

Former Member
0 Kudos

You are thanking me for the new concept and asking further question about your original concept

Well, see the help on dataset usage [http://help.sap.com/saphelp_40b/helpdata/en/34/55cad198482bc0e10000009b38f91f/content.htm|http://help.sap.com/saphelp_40b/helpdata/en/34/55cad198482bc0e10000009b38f91f/content.htm]