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

Reading the file as CSV

Former Member
0 Likes
777

Hi All,

I have problem in reading the file from excel , i copied the file from excel as csv AND STORED IN ftp FOLDER

i USE FTP CONNECT AND FTP COMMAND TO READ THE FILE AND THEN USING open DATA SET method

and split the file at comma and into some lv_rec and the contents into workarea of the internal tabel

the problem is iam getting the file contents but at the end of each record i am getting # at the end of each record

aprreciated if any body have the clue to get rid of # .

Regards

subbara

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
734

Hi,

the '#' character is probably a line separator. You can remove it programmatically, but it is probably better to try to use addition [OPEN DATASET - linefeed |http://help.sap.com/abapdocu_70/en/ABAPOPEN_DATASET_LINEFEED.htm] whe opening a file. Check also [OPEN DATASET - os_additions |http://help.sap.com/abapdocu_70/en/ABAPOPEN_DATASET_OS_ADDITION.htm].

Regards,

Adrian

Hi,

the '#' character is probably a line separator. You can remove it programmatically, but it is probably better to try to use addition [OPEN DATASET - linefeed |http://help.sap.com/abapdocu_70/en/ABAPOPEN_DATASET_LINEFEED.htm] whe opening a file. Check also [OPEN DATASET - os_additions |http://help.sap.com/abapdocu_70/en/ABAPOPEN_DATASET_OS_ADDITION.htm].

Regards,

Adrian

6 REPLIES 6
Read only

Former Member
0 Likes
734

Hello subbara

This is the line separator, you can use the public constant CR_LF of the class cl_abap_char_utilities ( cl_abap_char_utilities=>cr_lf ) to check all the occurrences of this separator.

Declare a string internal table and do a split command to have all the records without the separator.

Hope it helps

Kleber Santos

Read only

0 Likes
734

Hi kleber,

I am not familiar with oops concepts , can declare the conatant i the declaration and i will do without seperator.

please put a line of code how to use the method or class in the code.

Regards

subbara

Read only

0 Likes
734

Hi,

if you want to remove # programmatically, you can do it like this

REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>cr_lf IN gv_string WITH ''.

for string.

REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>cr_lf IN TABLE gt_string_table WITH ''.

for table of strings.

But I still think, that using some addition for OPEN DATASET statement would be a better solution.

Regards,

Adrian

Read only

0 Likes
734

resolved

Read only

Former Member
0 Likes
735

Hi,

the '#' character is probably a line separator. You can remove it programmatically, but it is probably better to try to use addition [OPEN DATASET - linefeed |http://help.sap.com/abapdocu_70/en/ABAPOPEN_DATASET_LINEFEED.htm] whe opening a file. Check also [OPEN DATASET - os_additions |http://help.sap.com/abapdocu_70/en/ABAPOPEN_DATASET_OS_ADDITION.htm].

Regards,

Adrian

Read only

Former Member
0 Likes
734

Thanks for youe help. resolved.