cancel
Showing results for 
Search instead for 
Did you mean: 

CSV File Handling Issue

Former Member
0 Kudos

Hi All,

We have IDoc to File(CSV) Scenario.

Target Field Values have comma(,) character in it.  Field Separator : comma(,)

Fields contain comma disturbs the File Generation Sequence.

eg.,

Header

field 1, field 2, field 3, field 4

field 1=test

field 2=sample

field 3=firstname,lastname

field4 = address

Output CSV:

field1, field2 , field 3, field 4

test,sample,firstname,lastname,address

Field 3 Value has been splitted into two. How to handle this case. Kindly help

Best Regards,

Suresh S

Accepted Solutions (1)

Accepted Solutions (1)

steve_coombes
Participant
0 Kudos

Hello Suresh

A CSV field containing a comma should be enclosed in double quotes. Can you add quotes to the output?

Kind regards

Steve

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Double Quotes inclusion at Mapping level and following FCC Parameters helped to resolved that issue.

However, we just need to exclude again the double quotes in the field before posting it to end Application which can be handled through FTP Module level configuration.

Does anyone have idea about Standard Adapter Module which handle my requirement

Best Regards,

Suresh S

steve_coombes
Participant
0 Kudos

Hello Suresh

If the target application can't cope with the quotes, how does it require the output to be formatted when there is a comma in the data?

I found a similar discussion where Stefan Grube says it isn't possible to use commas in data and as a field separator.

http://scn.sap.com/thread/1810628

Kind regards

Steve

Ryan-Crosby
Active Contributor
0 Kudos

Hi Steve,

If the target application cannot handle double quotes for enclosure then the next option is a new delimiter such as |. 

Regards,

Ryan Crosby

Former Member
0 Kudos

Hi Suresh,

Here is the simple udf to remove or replace at comma in the third filed.

public String ReplComma(String var1, Container container) throws StreamTransformationException{

return var1 = var1.replaceAll(",", " ");

former_member184720
Active Contributor
0 Kudos

we don't need a UDF to replace string. the standard function "replaceString" can handle..

Also i don't think we should remove the comma.. instead add the double quotes suggested by Steve..

Former Member
0 Kudos

Hi Suresh,

If you do not want comma in third field try to remove at mapping level and pass it target.