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 format file

Former Member
0 Likes
666

Hi all,

i ahve a requirement to save contentes of database in CSV file. but the values that i get must be enclosed in double quotes ("). i am able to convert the file to CSV but can any1 tell me how to enclose each value within a ". for example i want the file contents to be like tis:

EG: “E “,”30000001”,”SAP LEARNING SOLUTION BASIC “,”06.12.2007”,”00379700”,”06.12.2009”

Regards

Sabah....

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
620

Hi,

If this is the requirement then you need to concatenate each field

concatenate ' " ' <fieldname> ' " ' into <workarea>.

and then concatenate again

separated by comma.

Jayant Sahu

4 REPLIES 4
Read only

Former Member
0 Likes
620

hi,

just concatenate " with the variables that hold respective values.

-siva

Read only

0 Likes
620

hi

i used concatenate, but its deleting the spaces from between, but i also want spaces in it. soi used respecting spaces in concatenate. Can any1 tell me how to insert a double quote at column Zero, i.e before anythig....

Read only

Former Member
0 Likes
620

Coding -

TYPE-POOLS: truxs.

TYPES:

BEGIN OF ty_Line,

vbeln LIKE vbap-vbeln,

posnr LIKE vbap-posnr,

END OF ty_Line.

TYPES: ty_Lines TYPE STANDARD TABLE of ty_Line WITH DEFAULT KEY.

DATA: itab TYPE ty_Lines.

DATA: itab1 TYPE truxs_t_text_data.

SELECT

vbeln

posnr

UP TO 10 ROWS

FROM vbap

INTO TABLE itab.

CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'

EXPORTING

i_field_seperator = ';'

TABLES

i_tab_sap_data = itab

CHANGING

i_tab_converted_data = itab1

EXCEPTIONS

conversion_failed = 1

OTHERS = 2.

IF sy-subrc 0.

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

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

ENDIF.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = 'C:\TEMP\test.txt'

TABLES

data_tab = itab1

EXCEPTIONS

OTHERS = 1.

Read only

Former Member
0 Likes
621

Hi,

If this is the requirement then you need to concatenate each field

concatenate ' " ' <fieldname> ' " ' into <workarea>.

and then concatenate again

separated by comma.

Jayant Sahu