‎2006 Dec 19 8:00 AM
Hello all,
Im downloading an internal table into a CSV file to PC, which contains some QUAN, CURR fields. Im using the 'semicolon' as seperater in FM SAP_CONVERT_TO_CSV_FORMAT. Then Im downloading with GUI_DOWNLOAD.
Problem is .. there are values for QUAN fields like below..
1,00 ( = 1.00 means cama is used as decimal notation)
12,22 ( = 12.22)
So, when displaying EXCEL.. 12 and 22 are falling into two different colomns of XL(CSV file). But if it is 12.22 then displaying correctly in a single colom of XL(CSV file).. But I need to display as 12,22 only..please help.
Thanks in advance.
‎2006 Dec 19 8:04 AM
hI
Try download using GUI_DOWNLOAD without using SAP_CONVERT_TO_CSV_FORMAT.
‎2006 Dec 19 8:04 AM
hI
Try download using GUI_DOWNLOAD without using SAP_CONVERT_TO_CSV_FORMAT.
‎2006 Dec 19 8:06 AM
‎2006 Dec 19 8:29 AM
‎2006 Dec 19 8:41 AM
Hi..
Here is a the sample program Im trying..
REPORT zmb_test2.
TYPE-POOLS : truxs.
DATA: t_itab1 TYPE truxs_t_text_data.
DATA: BEGIN OF t_tab1 OCCURS 0,
f1 LIKE mara-matnr,
f2 TYPE netpr, " curr field
f3(20) TYPE n,
END OF t_tab1.
t_tab1-f1 = 'mat1'.
t_tab1-f2 = '1111'.
t_tab1-f3 = 'mat111'.
APPEND t_tab1.
t_tab1-f1 = 'mat2'.
t_tab1-f2 = '2222'.
t_tab1-f3 = 'mat222'.
APPEND t_tab1.
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
i_field_seperator = ';'
TABLES
i_tab_sap_data = t_tab1
CHANGING
i_tab_converted_data = t_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:\ZMB_TEST.CSV'
TABLES
data_tab = t_itab1
EXCEPTIONS
OTHERS = 1.
and output is as below.. (falling into two coloms of XL)
mat1;1.111 00;00000000000000000111
mat2;2.222 00;00000000000000000222
but the expected output is .. (single colom of XL)
mat1;1.111,00;00000000000000000111
mat2;2.222,00;00000000000000000222
Please help me ..
‎2006 Dec 19 8:48 AM
Hi Matt,
This is a problem that you will face in Excell when you click on the file and then open with excel.
Try with the following steps,
1. Open Microsoft Excel Application
2.Goto Data->Get External Data ->Import text file
3.Choose the file name of your downloaded file then choose Delimited
4. Click on Next->and choose the Semicolon option only and then Finish
Now you would be able to see the file in the format that you require in Excel
‎2006 Dec 19 8:38 AM
Hi,
Try this.
First block will be filling fileds names.
it_send_mail_cats contains the data. to be downloaded.
it_content4-name = text-h01.
APPEND it_content4.
CLEAR it_content4.
it_content4-name = text-h13.
APPEND it_content4.
CLEAR it_content4.
it_content4-name = text-h02.
APPEND it_content4.
CLEAR it_content4.
it_content4-name = text-h03.
APPEND it_content4.
CLEAR it_content4.
it_content4-name = text-h04.
APPEND it_content4.
CLEAR it_content4.
it_content4-name = text-h05.
APPEND it_content4.
CLEAR it_content4.
it_content4-name = text-h06.
APPEND it_content4.
CLEAR it_content4.
it_content4-name = text-h07.
APPEND it_content4.
CLEAR it_content4.
it_content4-name = text-h08.
APPEND it_content4.
CLEAR it_content4.
it_content4-name = text-h10.
APPEND it_content4.
CLEAR it_content4.
it_content4-name = text-h11.
APPEND it_content4.
CLEAR it_content4.
it_content4-name = text-h15.
APPEND it_content4.
CLEAR it_content4.
it_content4-name = text-h16.
APPEND it_content4.
CLEAR it_content4.
it_content4-name = text-h12.
APPEND it_content4.
CLEAR it_content4.
it_content4-name = text-h14.
APPEND it_content4.
CLEAR it_content4.
it_content4-name = text-h09.
APPEND it_content4.
CLEAR it_content4.
DESCRIBE TABLE it_content LINES v_n.
v_i = 2.
WHILE v_i <= v_n.
READ TABLE it_content INDEX v_i.
it_content1-line = it_content-line.
v_i = v_i + 1.
READ TABLE it_content INDEX v_i.
it_content+254(1) = ' '.
CONCATENATE it_content1-line it_content-line INTO it_content1-line.
APPEND it_content1.
CLEAR it_content1.
v_i = v_i + 1.
ENDWHILE.
WRITE:/ text-023,filename.
CONCATENATE filename '.XLS' INTO filename.
MOVE filename TO lv_filename.
PERFORM set_trail_blanks(saplgrap) USING 'X'.
PERFORM set_fixlen(saplgrap) USING '0' '510'.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = lv_filename
filetype = 'DAT'
APPEND = ' '
WRITE_FIELD_SEPARATOR = '#'
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
dat_mode = 'X'
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 = it_send_mail_cats
fieldnames = it_content4
‎2006 Dec 19 8:42 AM
use , as separator instead of semicolon and give file type in GUi_download as 'DAT'