‎2008 Jan 24 1:14 PM
how to write an internal table to a .csv file on application server using OPEN DATASET output?
‎2008 Jan 24 1:17 PM
U can't write data of internal table as .csv format in an application server. U can just dump the data line by line in application server and then may be u can write another program to read this data and do changes and download to .csv format file.
‎2008 Jan 24 1:30 PM
HI Suhas,
Try the follwoing way.
loop at itab.
concatenate itab-field1 itab-field2....into itab_new-data separated by ','.
append itab_new.
clear itab_new.
endloop.
open dataset <filename> for output in text mode.
loop at itab_new.
transfer itab_new to <filename>.
endloop.
close dataset <filename>.
Regards,
Ravi Kanth Talagana
‎2008 Jan 24 1:54 PM
Hi Suhas,
You can use like this:
DATA: e_file like rlgrap-filename value '/usr/sap/tmp/file.txt'.
open dataset e_file for output in text mode.
lOOP AT it_datatab......
transfer it_datatab to e_file.
ENDLOOP.
close dataset e_file.
Reagrds
Sourabh Verma
‎2008 Jan 24 8:13 PM
Hello Suhas
I think if you do not provide a file name for function module SAP_CONVERT_TO_CSV_FORMAT (using cl_abap_char_utilities=>horizontal_tab as delimiter) then the fm convert a structured itab into an unstructured itab (holding TAB separated data).
Then you can use this unstructured itab as input for the OPEN DATASET statement.
Regards,
Uwe
‎2009 Oct 21 9:25 AM