cancel
Showing results for 
Search instead for 
Did you mean: 

Skiping column in csv file

Former Member
0 Kudos

Hi, specialists!

I need to get CSV file, using File Adapter. The problem is, that the last column of the file is Comments, so there could be commas, so File adapter thinking that it is a new column.

(I can't change file's structure or use another delimiters instead commas)

Is there any way to skip the last column in file?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello,

Try to use row.missingLastfields parameters:

row.fieldNames:IdNum,Name,Group,OrgUnit,Position,Status,ExecuteDate,Mark,Comments,EMPTY1,...,EMPTY_N

where N = max commas in Comment field, i think thant N = 5 is suitable value for any comment.

and other parameters:

row.fieldSeparator: ,

row.endSeparator: 'nl'

row.missingLastfields: ignore

BR,

Dzmitry

Former Member
0 Kudos

Wow, Dzmitry! It's a great solution effective and simple. Thank you!!!

Regards,

Dan

Answers (4)

Answers (4)

Former Member
0 Kudos

Dani,

Can you post one or two lines of the source message.

Then it's easier to analyse.

GReets

Former Member
0 Kudos

Hi Patrick!

Sure I can.

Here is the structure of my csv file:

____________________________________________________________________________

IdNum

Name

Group

OrgUnit

Position

Status

ExecuteDate

Mark

Comments

Source:

300919669 Fill 1 Customer 111 Smit Smit Done 27/02/2008 75 Failed, low mark

In "Comments" I can get some text with commas.

Here is my xml message in XI:

<?xml version="1.0" encoding="UTF-8"?>

<ns0:MarksMT>

<Row>

<IdNum/>

<Name/>

<Group/>

<OrgUnit/>

<Position/>

<Status/>

<ExecuteDate/>

<Mark/>

<Comments/>

</Row>

</ns0:MarksMT>

Edited by: Dani_K on Feb 23, 2009 3:08 PM

Edited by: Dani_K on Feb 23, 2009 3:10 PM

Former Member
0 Kudos

Hi Dan

The best way is using Structure.additionalLastFields:ignore as explained by the fellow SDNers..If its not working for you, then I think you can write a small scripts which replaces commas from the source( of the Comments Column) using "Run operating System command Before Message Processing". Then you will not have comma in the last column...If you want commas to be replaced in the target file, use "Run operating System command After Message Processing" to replace "comma" with ','.

P.S: You know how many commas you will have before the last Column ( Comments Column), so you can by default leave that many occurrence of commas then start replacing them

Hope this is useful

Former Member
0 Kudos

Yes, I tried "additionalLastFields" it didn't help, I've got the:

ERROR in configuration: more elements in file csv structure than field names specified

Former Member
0 Kudos

Hi,

Have you tried setting the additionalLastFields parameter to 'ignore'? See [http://help.sap.com/saphelp_nwpi71/helpdata/en/44/6713ec3f914ddee10000000a1553f7/frameset.htm] for details.

Kind regards,

Koen

Former Member
0 Kudos

Hi,

Try the below parameter..

Structure.additionalLastFields:ignore

Regards,

Prakasu