cancel
Showing results for 
Search instead for 
Did you mean: 

CPI message mapping two different xml formats (multimap messages) in XSLT

PradeepBondla
Active Contributor
0 Kudos

Hi,

I am trying to merge two different formats of xmls (from SuccessFactors and ERP) to one single message in XSLT mapping. I used join and gather to get both message to single xml.

XML from Successfactors has below format

<?xml version="1.0" encoding="UTF-8"?> 
<PerPerson>
<PerPerson>
<personIdExternal>12345</personIdExternal>
<name>Pradeep</name>
....
</PerPerson>
</PerPerson>

XML from ERP using RFC adaptor has format

<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
<rfc:ZHR_GET_EMP_BENEFIT_DETAILS.Response xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
  <LT_0167>
     <item>       
      <PERNR>00012345</PERNR>
        <DOB>01/01/2020</DOB>
        ....
    </item>   </LT_0167> </rfc:ZHR_GET_EMP_BENEFIT_DETAILS.Response>

After Join & Gather, both are in single XML like below with <multimap:messages> tags

<?xml version='1.0' encoding='UTF-8'?>
<multimap:Messages xmlns:multimap="http://sap.com/xi/XI/SplitAndMerge">
  <multimap:Message1>     
    <PerPerson><PerPerson>
    <personIdExternal>12345</personIdExternal>
    </PerPerson></PerPerson>   
  </multimap:Message1>
  <multimap:Message2>     
     <rfc:ZHR_GET_EMP_BENEFIT_DETAILS.Response xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
       <LT_0167>
        <item>
        <PERNR>00012345</PERNR></item>
        <DOB>01/01/2020</DOB>
        ....
       </LT_0167>    
     </rfc:ZHR_GET_EMP_BENEFIT_DETAILS.Response>   
  </multimap:Message2> 
</multimap:Messages>

How to write XSLT for above to combine tags under multipmap message1 (SF data) & maultipmap message 2 (ERP data) to get final output as below with same PersonalID & PERNR?

Required Output:

<?xml version="1.0" encoding="UTF-8"?> 
<PerPerson xmlns:xs="http://www.w3.org/2001/XMLSchema">   
<PerPerson>     
<EmployeeID>12345</EmployeeID>  "from multimap:message1 & multimap:message 2 comparison / same value
<DOB>01/01/2020</DOB>                "from multimap:message 2
<Name>Pradeep</Name>                "from multimap:message 1

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

I am on the same boat, how did you solved this? Thanks.

PradeepBondla
Active Contributor
0 Kudos

Hi Sagar,

I have achieved it through groovy script code. You can see my code and question to finetune my code in other forum with below link.

https://stackoverflow.com/questions/65526399/groovy-script-code-to-append-xml-node-taking-15-hours-f...

hope it helps.

-Pradeep

vijender_p
Active Participant
0 Kudos

Hi pradeepbondla,

I Suggest you another way Where you can use a Graphical Mapping for achieving it. Just Create a XSD Structure how you want as a output and do the mapping from the multi mapping (Strcture From the Source) to a single structure.

Regards,

Vijender

PradeepBondla
Active Contributor
0 Kudos

Thank you Vijender,

I am new to CPI / XSD / XSTL. So you are suggesting to user "Message Mapping" pallet right after "Gather" (which gives multi message xml) to make it into plane, single structure xml by removing multimessage tags? and then send that as output to XSLT (I am using XSLT for some other calculations already)? Please check my iFlow image and suggest.

Thanks again.

Pradeep

vijender_p
Active Participant
0 Kudos

What is the other calculations which your adding in XSLT.

Regards,

Vijender

PradeepBondla
Active Contributor
0 Kudos

Date formatting, Phone number formatting, display fields based on condition on other incoming fields, showing extended names based on incoming value.

Thank you,

Pradeep