Skip to Content

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

Mapping Issue

Hi Gurus,

we have a following requirement;

input xml;

<root>

<material>

<id>AAA</id>

<value>10</value>

</material>

<material>

<id>AAA</id>

<value>-10</value>

</material>

<material>

<id>BBB</id>

<value>20</value>

</material>

<material>

<id>CCC</id>

<value>30</value>

</material>

</root>

As per the above source file having one duplicate record with ID = "AAA" . One of this record have a negative value (-10), so here my requirement is need to update at receiver side as below.

output.xml;

<root>

<material>

<id>BBB</id>

<value>20</value>

</material>

<material>

<id>CCC</id>

<value>30</value>

</material>

</root>

We just need to delete both record lines with same ID when one of the value is negative.

Thanks in advance,

Peter

Former Member
replied

Hello,

The above output is possible without using UDF. The mapping below assumes that the ids are already sorted as was described by your example:

Legend: rc - removeContext

fBE - formatByExample

cC - collapseContext

sBV - splitByValue VC - valueChanged EV - eachValue

For Material


   value -> rC -> fBE -> sort:ascending -> cC -> sBV:EV -> greater: -1 -> ifWithoutElse -> rC -> Material
id -> rC -> sBV:VC /                                id -> rC -> sBV:VC -> /

For id


   value -> rC -> fBE -> sort:ascending -> cC -> sBV:EV -> greater: -1 -> ifWithoutElse -> rC -> sBV:EV -> id
id -> rC -> sBV:VC /                                id -> rC -> sBV:VC -> /

For value


value -> rC -> fBE -> sort:ascending -> cC -> sBV:EV -> greater: -1 -> ifWithoutElse -> rC -> sBV:EV -> value
id -> rC -> sBV:VC /                             value -> rC -> fBE -> /
                                          id -> rC -> sBV:VC -> /

Apologies for the shorthand notation.

Hope this helps,

Mark

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