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

Converting .xls sheet into .csv sheet

Former Member
0 Likes
2,953

Dear All,

Is there any program available which will convert an excel sheet into .csv sheet.

If anyone has worked on this then please forward me the code for the same.

Regards,

N.Jain

4 REPLIES 4
Read only

Former Member
0 Likes
1,190

hi Nishu,

Check out this related thread

Regards,

Santosh

Read only

0 Likes
1,190

Hi,

The above said link has put the data from excel sheet into the internal table. Does anybody has the sample code now to download the contents of internal table into csv sheet.

Regards,

N.Jain

Read only

0 Likes
1,190

Hi Nishu,

Use the following code

data: fname type string value 'C:\file.csv'.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

FILENAME = fname.

FILETYPE = 'ASC'

WRITE_FIELD_SEPARATOR = ','

TABLES

DATA_TAB = itab

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

Here above declare file variable fname of type string and pass the file path. In the function module 'itab' is the internal table where you have data that needs to be exported to .csv file and make sure that you have given WRITE_FIELD_SEPARATOR = ',' which is comma separator.

Here I am assuming that you have taken data from excel sheet to internal table 'itab' using Santhosh posting message.

Regards,

yellappa.

Edited by: yellappa m on Feb 8, 2008 12:07 PM

Read only

0 Likes
1,190

Use the FM SAP_CONVERT_XLS_TO_SAP to upload the data in the excel sheet and then convert the data into CSV format by using the FM SAP_CONVERT_TO_CSV_FORMAT.

And then use the FM GUI_DOWNLOAD to download the data .

Reward if helpful.

Thanks,

Avanish Joshi