01-12-2011 4:08 AM
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.
01-12-2011 4: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.
01-12-2011 5:28 AM
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.
07-26-2011 10:29 AM
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 ..
01-22-2014 7:32 PM
01-23-2014 4:24 AM
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