cancel
Showing results for 
Search instead for 
Did you mean: 

SAP CPI- XML to CSV Converter " sign appears

0 Kudos

Hello,

I am using XML to CSV Converter in my Integration process in SAP CPI landscape

I have the input XML format (attached file- inputxml.txt) to XML-CSV Converter

Configuration at the XML-CSV converter

Path to source element: File/Recordset

Field Seperator: n . Rest all the remaining boxes are unchecked

After XML-CSV Converter I am receiving output in below format-

"123,ABC,abc@testing.com"

"456,DEF,def@testing.com"

"789,XYZ,xyz@testing.com"

I am unsure why I am getting " enclosure sign at the start and end of the value. Can anyone help me in understanding why this " sign is appearing?

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

bhalchandraswcg
Contributor

Hi omkar_p,

Based on your input, the output you are receiving is the expected output. This is the standard behaviour.

Any elements under what you configure as 'Path to Source Element in XSD' are copied as individual columns. In your input of /File/Recordset, there is a single element named 'Record', so values of 'Record' are copied one after the other.

If you expect the output like below, perhaps, an XSL transformation might be a better option:

123,ABC,abc@testing.com

456,DEF,def@testing.com

789,XYZ,xyz@testing.com

Here's the XSLT:

<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output omit-xml-declaration="yes" />
	<xsl:template match="/">
	    <xsl:for-each select="/File/Recordset">
	        <xsl:value-of select="Record" />
	        <xsl:text>
</xsl:text>
	    </xsl:for-each>
	</xsl:template>
</xsl:stylesheet><br>

While, this would resolve the issue in this particular case, recommendation would be to redesign the source data model to send individual value in its own tag instead of like this. Example data model could generate data like:

<?xml version='1.0' encoding='UTF-8'?>
<File>
    <Recordset>
        <Id>123</Id>
        <Name>ABC</Name>
        <Email>abc@testing.com</Email>
    </Recordset>
    <Recordset>
        <Id>456</Id>
        <Name>DEF</Name>
        <Email>def@testing.com</Email>
    </Recordset>
    <Recordset>
        <Id>789</Id>
        <Name>XYZ</Name>
        <Email>xyz@testing.com</Email>
    </Recordset>
</File>

In this case, you would be able to configure XML to CSV converter as /File/Recordset and it would generate output like:

"123","ABC","abc@testing.com"
"456","DEF","def@testing.com"
"789","XYZ","xyz@testing.com"

Hope this helps,

Bala

Answers (2)

Answers (2)

eozkan
Explorer
0 Kudos

Just change the Path to source element:to File/Recordset/Record, it should pick up the elements under Record as columns.

Sriprasadsbhat
Active Contributor
0 Kudos

Hello Omkar,

Could you please provide exact input data and expected output data With field separator ( field separator you have provided is not part of the input data in above example ).

Regards,

Sriprasad Shivaram Bhat

0 Kudos

Hello Sriprasad,

This is my input XML data inputxml.txt to XML-CSV convertor

Path to Source Element in XSD: File/Recordset

Field Separator in CSV: n (New Line)

Expected Output:

123,ABC,abc@testing.com

456,DEF,def@testing.com

789,XYZ,xyz@testing.com

Thanks,

Omkar