08-10-2006 8:42 AM
I've an internal table. One of the fields contain text with comas. But when i try downloading the file in CSV format the field is splitted into two fields at the comma position. What could be the solution to this problem. Help me out.
08-10-2006 9:28 AM
Thanks Naimesh. I also tried all the possible options but of no use. Have to search other options. If you have any inputs regarding OLE concepts or material can you please share it with me
08-10-2006 8:45 AM
Hello,
replace , with something like - or ;
or download in .xls or .txt
regards,
Naimesh
08-10-2006 8:47 AM
Replacing is OK but i want the file to be downloaded in CSV format only. Users requirement
08-10-2006 8:57 AM
hi ,
1)use CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB as delimiter
2) replacing of deleimter is <b>no</b> data manipulation!
A.
08-10-2006 9:24 AM
Hello Phani,
There isn't any way. I have tried with all the options of filetype but I am not able to achieve this....
So, change file type or manipulate data.
regards,
Naimesh
08-10-2006 8:48 AM
There are other options like using a different delimeter or replace the comma in your field with some other character.
Regards
Anurag
08-10-2006 8:53 AM
But replacing the ',' with some other field will manipulate the DATA. I don't want that to happen.
I'm helpless in this regard. What to do?
08-10-2006 9:06 AM
Hi,
In WS_DOWNLOAD function module give the file name as something like 'C:\testing.csv' , filetype as 'DAT' and data_tab as your output internal table eg: itab[].
Remember to declare itab like:
BEGIN OF itab OCCURS 0,
text(3000) TYPE c,
END OF itab.
and store all the values in a single line separated by comma.
Regards
Subbu
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = 'C:\test.csv'
filetype = 'DAT'
APPEND = ' '
WRITE_FIELD_SEPARATOR = 'X'
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
IMPORTING
FILELENGTH =
TABLES
data_tab = i_output[]
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 .
08-10-2006 9:28 AM
Thanks Naimesh. I also tried all the possible options but of no use. Have to search other options. If you have any inputs regarding OLE concepts or material can you please share it with me
08-10-2006 9:35 AM
Hello,
Yes you can check report <b>RSDEMO01</b> for OLE for EXCEL. But, the problem remains as it is.
After running this progra, you can see your data in the excel after running this program, but when you save in .csv and again open it, your ',' deliminated got separated.
regards,
Naimesh