SAP PI message mapping does not map values

1.9k views Asked by At

In SAP PI 7.4 I'm experiencing some difficulties in trying to map something in a message mapping which would seem quite straightforward.

Input is something like this.

<Employee>
      <ExternalIdList>
          <ExternalId>aaa</ExternalId>
          <ExternalId>bbb</ExternalId>
          <ExternalId>ccc</ExternalId>
      </ExternalIdList>
</Employee>

I need this to map to something of the following structure:

<Newobject>
 <ExternalEmployeeList>
  <ExternalEmployee>
   <ExternalId>aaa</ExternalId>
  </ExternalEmployee>
  <ExternalEmployee>
   <ExternalId>bbb</ExternalId>
  </ExternalEmployee>
  <ExternalEmployee>
   <ExternalId>ccc</ExternalId>
  </ExternalEmployee>
 </ExternalEmployeeList>
</Newobject>

When trying to map, I'd do this as follows:

  • Employee -> NewObject
  • ExternalIdList -> ExternalEmployeeList
  • ExternalId -> ExternalEmployee
  • ExternalId -> ExternalId

When testing the mapping, 3 ExternalEmployee nodes are made, but only the first contains the value 'aaa' in the ExternalId. The other 2 ExternalEmployee nodes don't get an ExternalId:

<Newobject>
 <ExternalEmployeeList>
  <ExternalEmployee>
   <ExternalId>aaa</ExternalId>
  </ExternalEmployee>
  <ExternalEmployee/>
  <ExternalEmployee/>
  </ExternalEmployee>
 </ExternalEmployeeList>
</Newobject>

I've already tried quite some node functions or changed the context, but nothing seems to be working. What is the recommended solution for this?

Maybe add a XSLT mapping beforehand to insert a level between the ExternalIdList and the ExternalId in the input message? It seems like a lot of fuzz for this.

Thanks in advance, every tip in the right direction is welcome!

1

There are 1 answers

0
manuel_b On BEST ANSWER

the problem should be a missing context change in tag ExternalId.

try to fix the mapping in the following way:

ExternalEmployee (target) = ExternalEmployee

ExternalId (target) = splitByValue(ExternalId)

configure splitByValue choosing "Each Value" option

ExternalIDScreenshot

Also be sure that target ExternalEmployee have 1..unbounded occurrence !

This is the result Result

Best regards!