cancel
Showing results for 
Search instead for 
Did you mean: 

SAP PI : Mapping Multiple nodes to one node

03-18-2020 3:33 PM
4541 views 9 comments Go to solution
0 Likes
SAP Managed Tags
Subscribe

Hi,

Source XML :

Target Expected XML :

I would like to map my node "Puissances_Souscrites" (0. unbounded) to only one node "Puissances_Souscrites" (0.1) on my target.

Any idea ?

Thanks in advance.

0 Likes

Accepted Solutions (1)

Accepted Solutions (1)

former_member190293
Active Contributor

Hi Anthony!

And what's the problem?

Just switch context for source subnodes one level up and map to target subnode/attribute.

Regards, Evgeniy.

0 Likes

Well, thanks i have made a mistake. I put the wrong Context on attribute...

So i just let the first context on my target attribute and put the level up context on my subnode and it's works :

Answers (5)

Answers (5)

former_member190293
Active Contributor

Hi!

For target fields:

Demande_Mesures_PRM - > Demande_Mesures_PRM (direct mapping)

Constant(1) -> Puissances_Souscrites

Puissance_Souscrite (Context - Demande_Mesures_PRM) -> Puissance_Souscrite

Classe_Temporelle -> Classe_Temporelle (direct mapping)

Regards, Evgeniy.

former_member190293
Active Contributor

Hi!

It should work even if you have multiple Demande_Mesures_PRM nodes.

Regards, Evgeniy.

0 Likes

Actually the result is here :

The second occurrence don't map value.

When i try something else i've got this error :

Cannot create target element /Demande_Mesure/Demande_Mesures_PRM[2]/Puissances_Souscrites/Puissance_Souscrite. Values missing in queue context. Target XSD requires a value for this element, but the target-field mapping does not create one. Check whether the XML instance is valid for the source XSD, and whether the target-field mapping fulfils the requirement of the target XSD

Regards,

former_member190293
Active Contributor
0 Likes

Hi!

Regards, Evgeniy.

0 Likes

Well, it works now with this modification :

My node is 0.1 so i needed to use exists function instead of "C0nstant".

Thanks for all your answers 🙂

0 Likes

Hi,

I probably miss something.

For "Classe_Temporelle", i use the normal Context -> "Puissances_Souscrites"

For subnode "Puissance_Souscrite", i use the context level up like as you said -> "Demande_Mesures_PRM"

And for the node "Puissance_Souscrites", i use the Context -> "Demande_Mesures_PRM".

Regards,

0 Likes

Unfortunately, it work if my level up node "Demande_Mesures_PRM" is alone, like my previous screen.

In this other situation, i've two nodes "Demande_Mesures_PRM" .

And i expect that :