Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

1:n mapping

Hello experts,

as an inbound message I have a XML like following

<record>

<id>1</id>

<phone1>1234</phone1>

<phone2>1235</phone2>

<phone3>1236</phone3>

<mobile>1237</mobile>

<fax>3215</fax>

</record>

<record>

<id>2</id>

<phone1>5646</phone1>

<phone2>6544</phone2>

<phone3>8788</phone3>

<mobile>8785</mobile>

<fax>5454</fax>

</record>

<record>

<id>3</id>

<phone1>5455</phone1>

<phone2>2115</phone2>

<phone3>5454</phone3>

<mobile>3213</mobile>

<fax>2122</fax>

</record>

I need to map if to the outbound interface as following:

<record>

<id>1</id>

<type>phone1</type>

<number>1234</number>

</record>

<record>

<id>1</id>

<type>phone2</type>

<number>1235</number>

</record>

<record>

<id>1</id>

<type>phone3</type>

<number>1236</number>

</record>

...

<record>

<id>3</id>

<type>fax</type>

<number>2122</number>

</record>

The order of the outbound records is not important. How can this be done? Preferably in the graphical interface without programming.

Regards

Jiri

Former Member
Former Member replied

Hi Jiri

You can create a 1...unbounded RECORD field on target data type, with ID, TYPE and NUMBER as subfields.

In the graphical mapping, right click on the RECORD targe field and choose "Duplicate subtree".

A new RECORD will be added with all its subfields. Repeat this until you have a target RECORD for each source field like phone1, phone2....

Map target RECORD field with PHONE1, the second record with PHONE2, and so on.

You can just map them all with source RECORD field if all PHONE1, PHONE2... fields are mandatory.

Then you need to map the target ID with source ID.

For the TYPE target field, use a constant "PHONE1" and then map the PHONE1 field with target NUMBER field.

Iterate this replacing the constant "PHONE1" with the needed value and mapping target NUMBER field with correct source field.

Regards,

Giuseppe

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question