‎2012 Jan 24 8:39 AM
Hi
I am downloading data into CSV file separated by semi-colon. There are numeric fields with format 12.34
Can you please let me know how to download in format 12,34 (comma notation) in CSV file.
Thanks
Satish
‎2012 Jan 24 8:42 AM
Before moving the data to internal table you need to format your value. Use a char type variable. Is this a amount field if yes than you can use write to with currency and quanityt addition.
Nabheet
‎2012 Jan 24 8:49 AM
Thank you Nabheet for your quick response.
I have formatted before downloading but here the download is to CSV file. At place of comma the numeric value is broken into 2 parts.
‎2012 Jan 24 10:14 AM
add double quotes in each field..(before and after)
like
"abc";"def";"123,00";"56,45"
and then download into "test.CSV", your CSV file.. now when you open the excel it will all be in one column, you can either run a macro or do a text to column with delimiter as semicolon(;)..to split the column..
Now, if keeping semicolon is not mandatory, it will be even easier..
create lines like
"abc","def","123,00","56,45" ==> see i have kept commas for both delimiter as well as decimal separator
but when you download , it will only split the columns based on the delimiter commas not the commas which are inside " "s
Edited by: Soumyaprakash Mishra on Jan 24, 2012 3:46 PM
‎2012 Jan 24 11:03 AM
Thank you Soumyaprakash.
I have already done concatenation with quote. But still the the value is divided into 2 columns.
Ex:
CONDENSE wa_salaire_reference-salaire_base_mal.
CONCATENATE '"' wa_salaire_reference-salaire_base_mal '"' INTO wa_salaire_reference-salaire_base_mal.
‎2012 Jan 24 2:20 PM
i wrote a very simple code and it worked, let me know what you think of it..
REPORT ztest.
DATA: s1 type TABLE OF string,
sw like LINE OF s1.
move '"abcd","10,23","asdasd","10,00"' to sw.
append sw to s1.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'D:/ABC.CSV'
tables
data_tab = s1.
‎2012 Jan 25 4:52 AM
Soumyaprakash, your piece of code works well for comma separated CSV file but not for semi-colon separated file.
Could you please check.
‎2012 Jan 24 11:00 AM
‎2012 Jan 24 11:06 AM
I create the CSV file using GUI_DOWNLOAD with ASC type and .CSV extension.
File is being created successfully. Only problem with numeric fields (made character type in program).
‎2012 Jan 24 12:32 PM
ASC as file type controls how the data is prepared in the file.
the file extension does not really control anything of the file content.
if you exchange xls with doc, then word opens and tries to interpred the content, but the excel file did not really become a word document just while you change the extension.
So just adding an extension CSV does not make a CSV file fout of an ASC file.
Please have a look into this OSS note, it explains why SAP does not support CSV
Note 1066919 - Showcase GUI_UPLOAD: Comma separated value (CSV) file
contrary in OSS note 1167125 SAP says :
we suggest changing the download format into a CSV file by using the WRITE_FIELD_SEPARATOR = 'X' parameter for calling the GUI_DOWNLOAD and changing the file extension.
Edited by: Jürgen L. on Jan 24, 2012 2:19 PM