cancel
Showing results for 
Search instead for 
Did you mean: 

File Content Conversion - Double Quotes on Output Fields

Former Member
0 Kudos

Experts - I was not able to find a scenario similar to mine via searching, perhaps you know a solution:

I need to create a CSV file with the structure:

"FIELDNAME1","FIELDNAME2","FIELDNAME3","FIELDNAME4"

"value1","value2","value3","value4"

"value1","value2","value3","value4"

From structure:

<userlist>

<userinfo>

<FIELDNAME1>value1</FIELDNAME1>

<FIELDNAME2>value2</FIELDNAME2>

<FIELDNAME3>value3</FIELDNAME3>

<FIELDNAME4>value4</FIELDNAME4>

</userinfo>

<userinfo>

<FIELDNAME1>value1</FIELDNAME1>

<FIELDNAME2>value2</FIELDNAME2>

<FIELDNAME3>value3</FIELDNAME3>

<FIELDNAME4>value4</FIELDNAME4>

</userinfo>

</userlist>

So, using the Content Conversion parameters:

userinfo.fieldSeparator = '0x09'

userinfo.addHeaderLine = 1

userinfo.endSeparator = 'nl'

So, using this configuration I can get the general structure, but without the double quotes around ALL values.

Is there a Content Conversion setting that can be used to enclose the output strings in double quotes?

0 Kudos

Hi,

Solved, See the attachment !

capture.png

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Thank you all for the quick feedback. Unfortunately using the enclosureSign parameter does not seem to work. In review of the documentation, it is stated that the enclosureSign is only available for use in the Sender configuration, not the Receiver File FCC.

So we are back to where we started, it seems that SAP XI/PI does not support adding enclosure characters for creating a text document, only for text-to-XML. My proposed solution is to use an XSL mapping to add the required enclosure and then use simple FCC configuration to output the values. Is there a better approach?

Receiver Configuration (PI 7.11):

[http://help.sap.com/saphelp_nwpi711/helpdata/en/44/686e687f2a6d12e10000000a1553f6/content.htm|http://help.sap.com/saphelp_nwpi711/helpdata/en/44/686e687f2a6d12e10000000a1553f6/content.htm]

Sender Configuration (PI 7.11):

[http://help.sap.com/saphelp_nwpi711/helpdata/en/44/6713ec3f914ddee10000000a1553f7/content.htm|http://help.sap.com/saphelp_nwpi711/helpdata/en/44/6713ec3f914ddee10000000a1553f7/content.htm]

Former Member

Hi Tadd,

Did you try by using these three paramters:

.beginSeparator = "

.fieldSeparator = ","

.endSeparator = "'nl'

Then I think you should be good. The begin separator should start with double quotes and your field separator should be like what you want and the end separator ends with double quotes and a new line.

Try this out and let us know the updates.

If this doesn't work then I have other options in my mind like for each field you may con cat with double quotes and then you can use , as field separator. If this doesn't work then you can come up with a field for each start and end of double quotes and map with constant ". Here you might have more fields but your issue should be solved.

Regards,

---Satish

Former Member
0 Kudos

I added the beginSeparator, however, it simply puts double quotes at the beginning of the line:

"FIELDNAME1,FIELDNAME2,FIELDNAME3

"value1,value2,value3

"value1,value2,value3

I would like to hear what other ideas you have. Thanks for your time.

Former Member
0 Kudos

Hi Tadd,

It seems you have used only beginseparator. I would like you to use all the above three parameters and see how it goes. It should work your scenario.

Can you use all the three and update accordingly.

Regards,

---Satish

Former Member
0 Kudos

I did use all three, as you can see in the output.

Of course, I'm using the enclosing tag. I do not want to explicitly specify all the individual field elements as there are 22 of them, that would be quite a bit of time to setup. To be more detailed:

<users>

<user_info>

<firstname>Bob</firstname>

<lastname>Jenkins</lastname>

</user_info>

<user_info>

<firstname>Mike</firstname>

<lastname>Smith</lastname>

</user_info>

</users>

And my FCC is:

user_info.fieldSeparator = , (comma)

user_info.endSeparator = 'nl'

user_info.beginSeparator = " (double quotes)

Results in:

"Bob, Jenkins

"Mike, Smith

What am I doing wrong?

Former Member
0 Kudos

Hi Tadd,

Your FCC should be like this:

And my FCC is:

user_info.fieldSeparator = "," (doublequotes + comma + doublequotes)

user_info.endSeparator = "'nl' (doublequotes + newline)

user_info.beginSeparator = " (double quotes)

Dont put any space in between the characters. Try this and let us know the output. If you put the above parameters then i feel you should get:

"Bob","Jenkins"

"Mike"," Smith"

Regards,

---Satish

Former Member
0 Kudos

Thank you Satish. That did it. I have double quotes around all fields and it applied to the header as well. You saved me a lot of time. Many thanks.

Answers (4)

Answers (4)

diwakar_chintha
Explorer
0 Kudos

Hello TADD,

I am facing the same problem and when i used fieldSeparator as "," the data is getting converted.

But the data is getting converted when i use Simple structure in recordset but not for Complex Structures.

My Structure:

Record

     Header  1

     Data      *

     Line     *

When i use recordsetStructure = Header,1,Data,1,Line,1 it is working fine but when i use recordsetStructure = Header,1,Data,*,Line,* it is not working.

Please help.

Thanks in advance

Former Member
0 Kudos

Hi,

Use the following content conversion parameter :

userinfo.enclosureSign = "

in your FCC.

Regards

Ravi Anand

Former Member
0 Kudos

I understand that you would like to get double quotes on the output strings.

In the content conversion, use <NameA>.enclosureSign.

Explanation of parameter <NameA>.enclosureSign : Specify a string here that acts as a text delimiter. Text enclosed by such delimiters is transferred to the target structure unmodified although the default setting is to remove all text delimiters. Separators within such texts are ignored.

Former Member
0 Kudos

you can use <fieldname>.enclosureSign = " in your Content conversion.

http://help.sap.com/saphelp_srm40/helpdata/ru/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm

Regards

Ramg