Skip to Content

XML to excel conversion in File Content Conversion SAP PI

Hello Expert,

I need to do XML to excel conversion.

Please tell me what extra I should have to do in FCC??

below is my FCC

I am getting below output :

All output in 1 cell, I need it in different cells.

Please suggest me the changes.

Thanks,

Ravi

excel-fcc.jpg (40.6 kB)
output-fcc.jpg (22.0 kB)
Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    Posted on Oct 09, 2018 at 03:02 PM

    correct FCC.

    Recordset.fieldFixedLengths               2,2,2,2 
    Recordset.endSeparator                    '0x0D''0x0A' 
    Recordset.fieldNames                      Output_1,Output_2,Output_3,Output_4 
    Recordset.keyFieldInStructure             ignore 
    ignoreRecordsetName                       true 
    Recordset.fieldSeparator                  '0x09'
    
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 17, 2018 at 12:25 PM

    I'd recommend using the FormatConversionBean for this:
    https://blogs.sap.com/2014/11/03/exceltransformbean-part-2-convert-simple-xml-to-various-excel-formats-easily/


    FCC only creates Fixed Field lengths or CSVs

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 17, 2018 at 04:53 PM

    Hi Ravi,

    Below is a sample XML and XSLT mapping.

    Refer this and fulfill your requirement.

    Test XML -

    <ns0:MT_TEST_IN xmlns:ns0="urn://MM_Test_Sender">
    <RECORD>
    <NAME>awd</NAME>
    <AGE>21</AGE>
    <ADDRESS>XYZ</ADDRESS>
    </RECORD>
    <RECORD>
    <NAME>werwer</NAME>
    <AGE>65</AGE>
    <ADDRESS>PQR</ADDRESS>
    </RECORD>
    ns0:MT_TEST_IN>
    

    XSLT -

    <?xml version="1.0" encoding="utf-8"?>
    <?mso-application progid="Excel.Sheet"?>
    <xsl:stylesheet version="1.0" 
    xmlns:html="http://www.w3.org/TR/REC-html40"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
        xmlns="urn:schemas-microsoft-com:office:spreadsheet"
        xmlns:o="urn:schemas-microsoft-com:office:office" 
        xmlns:x="urn:schemas-microsoft-com:office:excel"
        xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
     
        <xsl:template match="/">
      <Workbook>
                <Styles>
                    <Style ss:ID="Default" ss:Name="Normal">
                        <Alignment ss:Vertical="Bottom" />
                        <Borders />
                        <Font />
                        <Interior />
                        <NumberFormat />
                        <Protection />
                    </Style>
                    <Style ss:ID="s21">
                        <Font ss:Size="22" ss:Bold="1" />
                    </Style>
                    <Style ss:ID="s22">
                        <Font ss:Size="14" ss:Bold="1" />
                    </Style>
                    <Style ss:ID="s23">
                        <Font ss:Size="12" ss:Bold="1" />
                    </Style>
                    <Style ss:ID="s24">
                        <Font ss:Size="10" ss:Bold="1" />
                    </Style>
                </Styles>
     
                <Worksheet ss:Name="Page1">
                    <Table>
                        <xsl:call-template name="XMLToXSL" />
                    </Table>
                </Worksheet>
            </Workbook>
     
        </xsl:template>
     
        <xsl:template name="XMLToXSL">
     
            <Row>
                            <Cell>
                                <Data ss:Type="String">Name</Data>
                            </Cell>
                            <Cell>
                                <Data ss:Type="String">Age</Data>
                            </Cell>
                            <Cell>
                                <Data ss:Type="String">Address</Data>
                            </Cell>
                             
                        </Row>
            <xsl:for-each
                select="//RECORD">
     
                <Row>
                    <Cell>
                        <Data ss:Type="String">
                            <xsl:value-of select="NAME" />
                        </Data>
                    </Cell>
                    <Cell>
                        <Data ss:Type="String">
                            <xsl:value-of select="AGE" />
                        </Data>
                    </Cell>
                    <Cell>
                        <Data ss:Type="String">
                            <xsl:value-of select="ADDRESS" />
                        </Data>
                    </Cell>
                </Row> 
            </xsl:for-each>
        </xsl:template>
    <xsl:template match="MT_TEST_IN">
    </xsl:template>
    </xsl:stylesheet>
    
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.