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: 

csv tab delimited problem

Former Member
0 Kudos

HI Experts,

I have a problem.

I have uploaded the file in csv format using Open dataset.

But they want in csv tab delimited format. I really dont understand how to do in this format.

I know only csv (the file will be separated by ',') and if tab delimited means ( file separated by '#').

How to achieve the csv tab delimited format.

Also, in file, if the field contains - no value, it comes as space. But that space while concatenating, it is not added. How to acheive a space while concatenating the fields.

Awaiting for your replies.

Thans in Advance,

Regards,

Sakthi Sri.

5 REPLIES 5

Former Member
0 Kudos

Hi,

Use the below code for tab delimiter.

data: l_seperator TYPE c.

CLASS cl_abap_char_utilities DEFINITION LOAD.

l_seperator = cl_abap_char_utilities=>horizontal_tab.

CONCATENATE field1 field2 field3

INTO <file name> SEPARATED BY l_seperator.

If you need the spaces where field1 is space you can get automatically by passing the work area whatever it contains and will display it as space in the CSV file.

Hope it will help u.

0 Kudos

Hi Rajesh,

Thanks for your reply.

I have simply tab delimit we use this. But my question is - is there any thing specific as csv tab delimited.

Because i need to store it as .csv file in AL11 directory and it should be tab delimited. how to achieve this.

0 Kudos

hi sri,

even iam facing the same issue...do you got any solution for this ?if so kindly guide me how to achieve.

thanks

Vamshi ..

0 Kudos

I have the same problem also. any suggestions is a big help!!

0 Kudos

hi,

DATA : FILENAME(128) DEFAULT '/usr/......../file.csv'. "" Your path in app server

DATA : lv_str type string.

data: l_seperator       TYPE c.       

  CLASS cl_abap_char_utilities DEFINITION LOAD.

  l_seperator = cl_abap_char_utilities=>horizontal_tab.

OPEN DATASET FILENAME FOR OUTPUT IN TEXT MODE.

CHECK sy-subrc EQ 0.

loop at i_item.

    CONCATENATE

                i_item-FIELD_1

                i_item-FIELD_2

                i_item-FIELD_3

                i_item-FIELD_4

                i_item-FIELD_5

               

                into lv_str

                SEPARATED BY  l_separator.

transfer lv_str to filename.

endloop.

* Close File

CLOSE DATASET FILENAME.

regards,

Siva Prasad