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

down loading internal table to .csv file format

Former Member
0 Likes
1,183

hi

its urgent !

how can i down load internal table to .csv file format?

Babumiya Mohammad

5 REPLIES 5
Read only

Former Member
0 Likes
792

If you have access to debugging then -

1. Click on the internal table.

2. Go to Menu GoTo>>Display Data Object>> Structure Editor.

3. Once the structure Editor opens , you can go to Menu System>>List>>Save and you can choose your extension.

Read only

Former Member
0 Likes
792

Hi!

The easiest way, if you enter to debugger mode, and click on table button, then click on the export to excel button.

Then save you excel as a CSV.

It's working with SAP 4.7+

Regards

Tamá

Read only

Former Member
0 Likes
792

use GUI_DOWNLOAD functon module... the only thing is while specfying the file path give the extension as .csv

Read only

Former Member
0 Likes
792

Hi Raje

use the function module as displayed below,

CALL FUNCTION 'WS_DOWNLOAD'

EXPORTING

CODEPAGE = 'xxx'

FILENAME = L_FILENAME

FILETYPE = 'CSV'

TABLES

DATA_TAB = I<YOUR INTERNAL TABLE>

EXCEPTIONS

FILE_OPEN_ERROR = 1

FILE_WRITE_ERROR = 2

INVALID_FILESIZE = 3

INVALID_TYPE = 4

NO_BATCH = 5

UNKNOWN_ERROR = 6

INVALID_TABLE_WIDTH = 7

GUI_REFUSE_FILETRANSFER = 8

CUSTOMER_ERROR = 9

OTHERS = 10.

IF SY-SUBRC <> 0.

SKIP 1.

WRITE:/1 'File download failed. File directory and name:',

L_FILENAME.

ELSE.

SKIP.

WRITE:/1 'File download successful. File directory and name:',

L_FILENAME.

ENDIF.

u can use the function module SAP_CONVERT_TO_CSV_FORMAT or GUI_DOWNLOAD

Plz award points if helpful,

Kiran .M

Read only

amit_khare
Active Contributor
0 Likes
792

Downloading a table with CSV format means fields are seperated by Comma.

For this concatenate all the table fields in an string field SEPARATED by Comma.

Condense it and download it.

data: begin of t_csv occurs 0,

text(1000) type c,

end of t_csv.

loop at itab.

concatenate itab-fld1 itab-fld2 ......into t_csv-text separated by ','.

condense t_csv

append t_csv.

endloop.

now download t_csv with extension .CSV

The standard FM has a hard coded ';' in it so it will not be CSV file.

Regards,

Amit

Reward all helpful replies.