简体   繁体   中英

SAP PI message mapping does not maps values

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 ExternalEmployees 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!

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

外部ID截图

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

This is the result结果

Best regards!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM