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

Convert internal table to CSV format

marisa_quaresma
Explorer
0 Likes
12,038

Hi.

I have an internal table with 83 columns. And I am using the function SAP_CONVERT_TO_CSV_FORMAT to convert it to the CSV format. The problem is that in the excel file it only appears 26 columns have anyone faced this problem?

1 ACCEPTED SOLUTION
Read only

0 Likes
6,720

Hi, other thing that you can do is, create a internal table with a simple field with 2000 characters length. Fill this internal table with all the columns that you have separated by comma ",". Use the function to download the internal table "GUI_DOWNLOAD" and specify the file with CSV extesion.

When you open the file, it will be open with Excel.

Let me know is this helped you.

Regards

Jesus Martinez

11 REPLIES 11
Read only

Former Member
0 Likes
6,720

how are you getting the data into Excel?

Read only

MrWhan
Participant
0 Likes
6,720

Are you using the semi-colon as your delimiter when opening the text file with Excel?

Read only

0 Likes
6,721

Hi, other thing that you can do is, create a internal table with a simple field with 2000 characters length. Fill this internal table with all the columns that you have separated by comma ",". Use the function to download the internal table "GUI_DOWNLOAD" and specify the file with CSV extesion.

When you open the file, it will be open with Excel.

Let me know is this helped you.

Regards

Jesus Martinez

Read only

0 Likes
6,720

GUI_DOWNLOAD supports transfers up to 1024 bytes, not 2000...

Read only

Former Member
0 Likes
6,720

Why don't you try with the function Download


DATA:  ZM_FICHERO(128),
             ZM_TIPO(3),
            ZM_TIPRES(3).

 CALL FUNCTION 'DOWNLOAD'
   EXPORTING  CODEPAGE    = SPACE
      FILENAME                        = 'C:\'
      FILETYPE                         = 'DAT'
       ITEM                                = 'REPORTE'
  IMPORTING  ACT_FILENAME     = ZM_FICHERO ' -->  Name of file to be saved
     ACT_FILETYPE     = ZM_TIPRES
       FILESIZE            = ZM_TAMANO   '--> size
  TABLES     DATA_TAB         = TI_DATA '--> ITAB 
  EXCEPTIONS INVALID_FILESIZE = 1
             INVALID_TABLA_WIDTH = 2
             INVALID_TYPE     = 3.

Read only

_IvanFemia_
Active Contributor
0 Likes
6,720

Hi,

why you do not export data in native excel?

try to read these blogs

[abap2xlsx - Generate your professional Excel spreadsheet from ABAP|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/20046] [original link is broken] [original link is broken] [original link is broken];

[xlsx2abap - Read and edit your Excel files from ABAP|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/20791] [original link is broken] [original link is broken] [original link is broken];

Code of this SCN Community project is shared on [Code Exchange|https://cw.sdn.sap.com/cw/groups/abap2xlsx]

Regards

Ivan

Read only

Former Member
0 Likes
6,720

hi,

in that case you create a program in se38 then define your structure or table, define itab ,then use

loop at itab.

call function module download.

end loop.

in download function module uncomment exporting, file name, file type and infront it_tab=itab.

you get your all data.

use filetype as dat format

Sulabh

Edited by: sulabh agrawal on Nov 10, 2010 5:07 AM

Read only

marisa_quaresma
Explorer
0 Likes
6,720

Hi.

I am using the semicolon separator. However I cannot use the function guidownload or the download one, because I need to export this excel as an attach in an email. I cannot export in native excel since it was requested to send it in CSV format.

Read only

marisa_quaresma
Explorer
0 Likes
6,720

Thank you Jesús Martinez, your answer solved my problem. But I had to put a semi colon ';' intead of the coma.

Best regards,

Read only

0 Likes
6,719

You are welcome, we are here to help us. Any other question, please let me know.

Have a great day!

Read only

0 Likes
5,146

I have another issue with the FM SAP_CONVERT_TO_CSV_FORMAT.  Everything works fine with this when we pass internal table as input but when we have uuid fields in the internal table, the output values do not appear properly. It comes as #﬍㻿必#쪞嗺賻 . Can anyone help here?