cancel
Showing results for 
Search instead for 
Did you mean: 

useOneAsMany problem in graphical mapping

che_eky
Active Contributor
0 Kudos

Hi All,

I am having trouble with a graphical mapping where I am using the node function useOneAsMany. From a source XML I am generating multiple IDOCS, here is a crude example of the source XML message:

<GetSite>

    <Member>

       <emailAddress>site1@gmail.com</emailAddress>

       <deliveryAddresses/>

    </Member>

    <Member>

       <emailAddress>site2@gmail.com</emailAddress>

       <deliveryAddresses>

          <MemberAddress>

             <accountAddressCode>1111</accountAddressCode>

          </MemberAddress>

          <MemberAddress>

             <accountAddressCode>2222</accountAddressCode>

          </MemberAddress>

       </deliveryAddresses>

    </Member>

</GetSite>

The graphical mapping generates one IDOC for each <MemberAddress> node in the source XML. In the above case it generates two IDOCS:

<IDOC>

    <Site>

       <accountAddressCode>1111</accountAddressCode>

       <Email>site2@gmail.com</Email>

    </Site>

</IDOC>

<IDOC>

    <Site>

       <accountAddressCode>2222</accountAddressCode>

       <Email>site2@gmail.com</Email>

    </Site>

</IDOC>

The <Email> field in the IDOC must come from the header node of the source XML <Member>. I have achieved this with the useOneAsMany node function. It works fine when <Member> contains sub-node <MemberAddress> as an Idoc is always generated. However when the source XML file contains <Member> with no sub-node <MemberAddress> it is causing a problem. See the example below:

As the useOneAsMany function takes <emailAddress> as the first input it is getting confused as the first occurrence of <emailAddress> in the above XML does not generate an IDOC (which is correct).

Does anyone have any advice on how to get around this issue?

Che

Accepted Solutions (1)

Accepted Solutions (1)

Harish
Active Contributor
0 Kudos

Hi Che,

You need to handle the suppress for the requirement, please refer the below mapping with all context to member in source

IDOC mapping

Site node mapping

Account address code

Email address mapping

Test result

regards,

Harish

che_eky
Active Contributor
0 Kudos

Hi Harish,

You are a star! Initial results look good, just need to do some more testing.

It is very tedious that each field mapping has to use the Member context, mapWithDefault and SplitByValue, I have a lot of other fields to map.

It maybe be a lot easier if I could remove those <Member> nodes that have no child node <MemberAddress>, perhaps using an XSLT. I have found in those cases the mapping works without any need for complex context mapping.

Che

Answers (0)