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: 

how to split these file

Former Member
0 Kudos

hi,

i need to split the flat file. the flat file is a csv format. i will show u one example of the test data for the flat file. I know for csv file we can split it using comma but the real problem is that the text <b>'To, existing plumbing and mechanical engineering installations Take off gutter of any size; securely refix brackets; refix existing gutter, remaking joints metal gutter</b>

contains , ; into it, that is where i am facing a problem.

eg for the flat file:

50000283 112B To, existing plumbing and mechanical engineering installations Take off gutter of any size; securely refix brackets; refix existing gutter, remaking joints metal gutter 1 m 12/1/2005 6.04

how to seperate this these flat file

1 ACCEPTED SOLUTION

abdul_hakim
Active Contributor
0 Kudos

Why don't u split using space character...

Abdul

4 REPLIES 4

abdul_hakim
Active Contributor
0 Kudos

Why don't u split using space character...

Abdul

0 Kudos

This is always a problem with CSV files. The only suggestion i can give is to change it to tab delimited file or use some other characters as separaters like '/' which may not be used as data in the file. So you can split at these characters and populate your data.

Former Member
0 Kudos

The sample that you gave does not look like a true CSV file.

50000283 112B To, existing plumbing....

I am guessing that 50000283 is a column, 112B is a column and then your text starts.

A true CSV file should be formatted:

50000283,112B, To, existing plumbing...

And to be truly correct with a CSV format, the fields should have double quotes around them so that you don't run into the issue of having commas in text intrepreted incorrectly:

"50000283","112B", "To, existing plumbing..."

When dealing with these types of text in a file, you need to be able to determine when the text begins and ends.

Chris

laxmanakumar_appana
Active Contributor
0 Kudos

Hi,

get the data into one variable and replace unwanted characters with space or comma according to your requirement. then use split operation.

code sample :

data : x_line(1000) type .

REPLACE ALL OCCURRENCES OF ';' IN x_line WITH ' '.

REPLACE ALL OCCURRENCES OF ';' IN x_line WITH ','.

Laxman