cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping help

former_member462539
Participant
0 Kudos

Hello PI Experts,

I need a help in a piece of mapping. Here is my requirement.

Source structure in Idoc.

<E1EDKA1></E1EDKA1>

   <PARVW> BK<PARVW>

<E1EDP01></E1EDP01>

  <PARVW> WE<PARVW>

My target structure should be

<contact>>/contact> ---> this node cardinal is 2..unbounded and role is 1:1.

<role>BK</role>

<role>WE</role>

<contact>>/Contact>

Would anyone help me on how to achieve this mapping with UDF since as I assume it can't be done through standard PI functions

Thanks

Brhamma

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Guys,

The fix is that you need a constant or a value in the Duplicate segment. Without that the segment will give an error saying that it cannot produce the structure and that it has changed.

Just add an constant and the problem will be solved.

Regards,

Jannus Botha

rodrigoalejandro_pertierr
Active Contributor
0 Kudos

hi

<contact>>/contact> ---> this node cardinal is 2..unbounded and role is 1:1.

<role>BK</role>

<role>WE</role>

<contact>>/Contact>

if role has a cardinality 1:1 and contact 2...N the result XML will be

<contact>>

        <role>BK</role>

</contact>

<contact>

      <role>WE</role>

</Contact>

to get the result that you define in the main post the cardinality od role should be 1:N

Please check this out to try help ypu properly.

BTW i assume that the solution for your scenario will be:

1). rigth click over <Contact> and select "Duplicate subtree"

2) map the 

E1EDKA1></E1EDKA1>

   <PARVW> BK<PARVW>  to the <Contact>--->Role

3) in the duplicated substree do this

   1)<PARVW> (E1EDP01) --> removeContext--> <contact>

     2) <PARVW> --> <Role>

try this out and let me know.

Regards

Rodrigo

Best Regards

Message was edited by: Rodrigo Alejandro Pertierra

former_member462539
Participant
0 Kudos

Sorry, it was a typo. Yes, this is correct structure which I would need. Basically contact node is to be generated twice based on header node and item level node. I changed the context and tested it in several ways, but no luck. The contact node and it's sub elements are getting generated twice of PARVW==BK(header) and it's simply ignoring item level condition elements. So thought of like I would need a UDF.

<contact>>

        <role>BK</role>

                     :

                     :

</contact>

<contact>

      <role>WE</role>

                    :

                    :

</Contact>

Regards

BV

rodrigoalejandro_pertierr
Active Contributor
0 Kudos

SO first you need to change the occurrance of the ROLE field to 0:unbounded later on you can solve your issue with my previiuos post.

Regards

Rodrigo

former_member462539
Participant
0 Kudos

I have to use standard source structures and standard target structures as it is and can't change in any way.

rodrigoalejandro_pertierr
Active Contributor
0 Kudos

HI, if you cannot change the target structure you wont be able to generate many <ROLE> fields you will only send it ONCE.

the other possiblity that remains is generate an structure like this

<contact>>

        <role>BK</role>

</contact>

<contact>

     <role>MS</role>

<contact>

<contact>

     <role>WS</role>

<contact>

ONE role per Contact segment. you dont have any more option.

check it with the funtional team. they shuold update the Funtional Document that tells you how to map the values with the structures involved

rgds

Rodrigo

Former Member
0 Kudos

Hi Vishnu

Can you please provide your exact target xml structure so that I can provide u the mapping.

former_member462539
Participant
0 Kudos

Hello Indrajit,

It may not be possible to copy my entire XSD here,since It's size is almost near to 1MB. see this screenshot.

ambrish_mishra
Active Contributor
0 Kudos

Hi Brhamma,

E1EDKA1 is at the header level and will occur once per IDoc while E1EDPA1 is at the item level and will occur multiple times per line item E1EDP01.

What is the condition for contact node creation?

Solution can be reached but the logic should be clear.

Ambrish

former_member462539
Participant
0 Kudos

Hello Ambrish,

Thank you for your response.

The condition is if PARVW==BK then map some of E1EDKA1 sub element's pertaining to address, to Contact node at target side. Similarly, if PARVW==WE then map some of E1EDPA1 sub element's pertaining to address, to Contact node at target side. Of course E1EDKA1 occurs only once, I agree.

E1EDPA1 segment is also occurring once though it occurs multiple times out of line item in general.

Regards

BV

ambrish_mishra
Active Contributor
0 Kudos

Hi Brahmma,

tried a quick prototype with what I could understand.

I created a dummy target structure as below:

Contact node has been duplicated. First contact node is mapped as below:

Street field is mapped as below with STRAS under E1EDKA1.

Second contact node has been mapped as below:

Street has been mapped similar as above.

I created a test case with 2 E1EDKA1 with one BK and 2 line item segments with first item having 2 E1EDPA1 with one WE and second Item with 3 E1EDPA1 with one WE as below:

I am able to produce 3 contact rows as below

I am not sure if it is that simple else why would you ask for UDF... do let me know if this is close.

cheers

Ambrish

former_member462539
Participant
0 Kudos

Duplicating node element is not working for some reason. however Contact node cardinality is 2..unbounded, so minimum 2 times it should occur. If I do duplication of this contact node, it is appearing 4 times of same value from Header level E1EDKA1 and missing E1EDPA1 item level items.

ambrish_mishra
Active Contributor
0 Kudos

>>>>>>>Duplicating node element is not working for some reason

I don't see any reason why it should not work. Try and change the cardnality to 0--unbounded and seee if its duplication happens.

Cardinality of 2--unbounded doe not mean it will be created twice atleast. It means it should be populated twice by the mapping...

Try to implement the solution as I suggested and let me know if you need further help.

Ambrish