Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

CSV file issue

Former Member
0 Likes
1,990

Dear all,

I am downloading a file using GUI_download for a CSV file . Its working file in MS-ExCEL but when we open it in edit mode in notepad , each entry is

having double quotes in the beginning and end both .

please share how to resolve this issue .

regards

vaibhav

11 REPLIES 11
Read only

Abhijit74
Active Contributor
0 Likes
1,441

Hello,

During population of internal table may be concatenation of Double quote has been made to get into column wise in excel file. So, the problem lies on your internal table population if you want to download into a notepad file.

I would like to suggest you that please change your row during population and at the end of data please  insert a carriage return line feed .

You can concatenate like below at the end of the line data:    cl_abap_char_utilities=>cr_lf

I think this will solve your issue.

Thanks,

Abhijit

Read only

Former Member
0 Likes
1,441

HI.

I hope your are converting file into CSV format by CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT'. and better use 'ASC' format while doing GUI_DOWNLOAD.

Thanks.

NJ

Read only

Former Member
0 Likes
1,441

Hi Vaibhav,

Have a look at these FM's

SAP_CONVERT_TO_CSV_FORMAT

SAP_CONVERT_TO_TEX_FORMAT

SAP_CONVERT_TO_TXT_FORMAT

SAP_CONVERT_TO_XLS_FORMAT

SAP_CONVERT_TO_XML_FORMAT

Hope this helps.

Thanks,

Tooshar Bendale

Read only

Former Member
0 Likes
1,441

Hi,

Try to download the file into .csv format which is shown below,

CALL FUNCTION 'GUI_DOWNLOAD'

     EXPORTING

       filename              = 'D:\T001.CSV'

       write_field_separator = ','

     TABLES

       data_tab              = t_t001.

Read only

0 Likes
1,441

hi ,

i am still  getting this error.

regards

Read only

0 Likes
1,441

Are you getting the same error?

we open it in edit mode in notepad , each entry is

having double quotes in the beginning and end both .

What is write_field_separator which you have taken?

Read only

0 Likes
1,441

Hi

Field separator = ','.

regards 

Read only

0 Likes
1,441

Hello,

Please check http://scn.sap.com/thread/1929726 link.

Thanks,

Abhijit

Read only

0 Likes
1,441

Its working fine for me.Even if I tried with downloaded file with .xls format and then I opened with notepad its working fine.

Read only

0 Likes
1,441

HI

LOOP AT it INTO wa.

   IF sy-subrc = 0.

     TRANSFER wa TO l_fname.

*      transfer wa-text2 to l_fname.

   ENDIF.

ENDLOOP.

*  BREAK-POINT.

CLOSE DATASET l_fname.

*

*CALL FUNCTION 'GUI_DOWNLOAD'

*  EXPORTING

**    BIN_FILESIZE                    =

*    filename                        =

*    filetype                        = 'ASC'

*    append                          = 'X'

*    write_field_separator           = ','

*    show_transfer_status            = abap_true

*    confirm_overwrite               = ' '

*  TABLES

*    data_tab                        = it

**    FIELDNAMES                      = IT_H

*          .

*IF sy-subrc <> 0.

*  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

*          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

*ENDIF.

l_fname contains filename .

please correct me for errors.

regards


Read only

Ryan-Crosby
Active Contributor
0 Likes
1,441

Hi,

Do any of the fields have comma values within the data?  If so, I believe the addition of the double quotes is so a front-end program that reads .csv files can determine when the commas are part of the data and when they are intended to be field separators.  I would check out the data first to see if that is causing the FM to insert the double quotes.

Regards,

Ryan Crosby