cancel
Showing results for 
Search instead for 
Did you mean: 

XSL: transformation hierarchical XML into flat xml for RFC in ERP

Former Member
0 Kudos

Hi All,

Hi All,  I have big problem with mapping. I read data from SOAP and i need put received XML to RFC in ERP by XI. Technicaly i have not problem, connection and otherwise is OK. Problem is only with mapping. The XML from SOAP is multilevel with parameters, but table in RFC is FLAT. Basic mapping and XSLT transform i know. But how to transform this XML to XML in bottom?. Have you any idea how to do it using XSLT version 1.0 please? Every parameters from XML I need in one specific column ("flat" xml).

Input XML:

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

<ns0:SNPR xmlns:ns0="http://xxxxxxxxxxxxx/">

            <ns0:status dateReaseon="2013-03-07" sCode="0" sText="OK"/>

            <ns0:statPD number="445522999" nP="ANO" dateZN="2013-03-02" numberF="451">

                        <ns0:zvU>

                                   <ns0:s1 dateCreate="2013-01-01" dateClose="2013-01-10">

                                               <ns0:standardUC pref="47" number="45456456" kBN="0340"/>

                                               <ns0:nostandardUC number="7897897"/>

                                   </ns0:s1>

                        </ns0:zvU>

            </ns0:statPD>

           

            <ns0:statPD number="4564" nP="NE" dateZN="2013-02-15" numberF="451">

                        <ns0:zvU>

                                   <ns0:s1 dateCreate="2012-01-01" dateClose="2013-11-10">

                                               <ns0:standardUC pref="47" number="1111111" kBN="1000"/>

                                               <ns0:nostandardUC number="7897789"/>

                                   </ns0:s1>

                                   <ns0:s1 dateCreate="2012-01-01" dateClose="2013-11-11">

                                               <ns0:standardUC pref="00" number="222222222" kBN="2000"/>

                                               <ns0:nostandardUC number="999"/>

                                   </ns0:s1>

                        </ns0:zvU>

            </ns0:statPD>

</ns0:SNPR>

I need this output XML: HOW TO DO IT BY XSLT please?

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

<roor>

    <item>

        <status_dateReason>2013-03-07</status_dateReason>

        <satus_sCode>0</satus_sCode>

        <status_sText>OK</status_sText>

        <statPD_number>445522999</statPD_number>

        <statPD_nP>ANO</statPD_nP>

        <sattPD_dateZN>2013-03-02</satPD_dateZN>

        <statPD_numberF>451</statPD_numberF>

        <statPD_zvU_s1_dateCreate>2013-01-01</statPD_zvU_s1_dateCreate>

        <statPD_zvU_s1_dateClose>2013-01-10</statPD_zvU_s1_dateClose>

        <statPD_zvU_s1_standardUC_pref>47</statPD_zvU_s1_standardUC_pref>

        <statPD_zvU_s1_standardUC_number>45456456</statPD_zvU_s1_standardUC_number>

        <statPD_zvU_s1_standardUC_kBN>0340</statPD_zvU_s1_standardUC_kBN>

        <statPD_zvU_s1_nostandardUC_number>7897897</statPD_zvU_s1_nostandardUC_number>

    </item>   

    <item>

        <status_dateReason>2013-03-07</status_dateReason>

        <satus_sCode>0</satus_sCode>

        <status_sText>OK</status_sText>

        <statPD_number>4564</statPD_number>

        <statPD_nP>NE</statPD_nP>

        <sattPD_dateZN>2013-02-15</satPD_dateZN>

        <statPD_numberF>451</statPD_numberF>

        <statPD_zvU_s1_dateCreate>2012-01-01</statPD_zvU_s1_dateCreate>

        <statPD_zvU_s1_dateClose>2013-11-10</statPD_zvU_s1_dateClose>

        <statPD_zvU_s1_standardUC_pref>47</statPD_zvU_s1_standardUC_pref>

        <statPD_zvU_s1_standardUC_number>1111111</statPD_zvU_s1_standardUC_number>

        <statPD_zvU_s1_standardUC_kBN>1000</statPD_zvU_s1_standardUC_kBN>

        <statPD_zvU_s1_nostandardUC_number>7897897</statPD_zvU_s1_nostandardUC_number>

    </item>   

    <item>

        <status_dateReason>2013-03-07</status_dateReason>

        <satus_sCode>0</satus_sCode>

        <status_sText>OK</status_sText>

        <statPD_number>4564</statPD_number>

        <statPD_nP>NE</statPD_nP>

        <sattPD_dateZN>2013-02-15</satPD_dateZN>

        <statPD_numberF>451</statPD_numberF>

        <statPD_zvU_s1_dateCreate>2012-01-01</statPD_zvU_s1_dateCreate>

        <statPD_zvU_s1_dateClose>2013-11-11</statPD_zvU_s1_dateClose>

        <statPD_zvU_s1_standardUC_pref>00</statPD_zvU_s1_standardUC_pref>

        <statPD_zvU_s1_standardUC_number>222222222</statPD_zvU_s1_standardUC_number>

        <statPD_zvU_s1_standardUC_kBN>2000</statPD_zvU_s1_standardUC_kBN>

        <statPD_zvU_s1_nostandardUC_number>999</statPD_zvU_s1_nostandardUC_number>

    </item>

</roor>

Thanks you All

Michal

Accepted Solutions (0)

Answers (4)

Answers (4)

markangelo_dihiansan
Active Contributor
0 Kudos

Hello Michal,

The mapping is pretty straight forward:

for item:

for status_dateReason/status_sCode/status_sText (taken from status section of source xml)

for statPD_number/statPD_nP/statPD_dateZN/statPD_numberF (taken from statPD section)

for staPD_zVU_s1_dateCreate/dateClose/standardUC_pref/standardUC_number/standardUC_kBn/nostandardUC_number (taken from s1 section of zVu)

Message Mapping Test

Ps: I have just grouped the nodes in the mapping screenshots, you can ungroup them as you like.

Hope this helps,

Mark

udo_martens
Active Contributor
0 Kudos

Hi Michal,

this is possible with xsl and as well with message mapping. XSL is here much easier because MM would require a lot node functions and context changes. Therefore, if you are free, take XSL. Copy the target into xsl:template element, replace each text node with xsl:value-of (you need only one item). Create the item by xsl:for-each select="//ns0:s1". Inside a item you need to access field direct, for example atPD_zvU_s1_nostandardUC_number. The fields on higher niveau can be accessed with X-Path expressions like ../../target (that means go 2 folders up).

/Udo

Former Member
0 Kudos

Hi, 

java is solution, but we have not java programmer - this way is not possible for us. 

Any easy way how to broke fields to higher level? 

What I mean: 

     1. complet input XML put as string to export parameters in RFC. Do you know how to put XML into string or into CDATA which I can put into export parametrs? 

     2. Input xml is multilevel, rfc has one internal table, flat table. Can I make internal table in export parameter as nasted? I think if I make structure which contains tables (simulate XML structure) the RFC can not by activated. RFC need flat table structure, its true?

Thanks

Michal

zameerf
Contributor
0 Kudos

Hi,


Can't we do this with graphical mapping?

Is there any specific reason to go for XSLT?

Regards,

Zameer

Former Member
0 Kudos

Hi, 

if the graphics mapping is right choice we can do this by this way.

Thanks

Michal

former_member184789
Active Contributor
0 Kudos

Hi,

If mapping one to one did not yield desired result, then could you please try changing the context of all the source fields to a higher level i.e all source fields brought into one context.