Skip to Content
author's profile photo Former Member
Former Member

csv tab delimited problem

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jan 12, 2011 at 04:18 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

    • 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

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.