Application Development 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: 

Data set-Storing in CSV format

Former Member
0 Kudos

Hi,

I can save my file to a text file but I want to store it in a CSV file.

Each Field should be under diffrent column.

How can achieve this?

Following code brings it to only single column.

CONCATENATE '
TEST\' sy-sysid '\FILE\' sy-datum '.txt' INTO p_file.

OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

LOOP AT t_output.

TRANSFER t_output-vtext TO p_file.

ENDLOOP.

CLOSE DATASET p_file.

IF sy-subrc NE 0.

MESSAGE 'Error closing the File' TYPE 'E'.

EXIT.

.

ELSEIF sy-subrc IS INITIAL.

WRITE : 'Everything OK!!!!, File saved in the Location' COLOR COL_POSITIVE , p_file.

ENDIF.

Rgds

Praveen

1 REPLY 1

uwe_schieferstein
Active Contributor
0 Kudos

Hello Praveen

Use the function module SAP_CONVERT_TO_CSV_FORMAT to convert your itab data to the .csv format. Do not use a filename for download.

Now you can loop over this converted itab data and store the file on your application server.

Regards,

Uwe