on ‎2023 Jan 30 1:37 AM
Hello SAP Integration Gurus,
I am trying to resolve the following mapping issue with UseOneAsMany node function for the following but stumling across errors despite trying various functions with in Node Functions.
Your help/advice is much appreciated. Thanks in advance.
Issue 1: In some cases in the payload we get just the 'OrgUnit' with no corresponding 'OrgUnitDetails' node. Meaning OrgUnits node and underlying child elements at Target should only display when 'OrgUnit' has underlying OrgUnitDetails (i.e. OrgUnit 99660043 with No underlying OrgUnit Details should be omiited). Please see Mapping for Issue 1 below.
Issue 2 : As you can see from the Source structure below at times we are getting 'OrgUnit Details' (Child nodes) twice for the same 'OrgUnit' with multiple/varying start and end dates along with other changes.
e.g. sender sends the same OrgUnit multiple times to cater different start and end dates and other changes (if any)
e.g. OrgUnit 99660043 has multiple start/end date as follows Start Date 1 : 2022.12.04 End Date1 : 2022.12.31 and then again Start Date 2 : 01.01.2023 | End Date 2 : 31.12.9999. Please see Mapping for Issue 2 below.
Source

Mapping for Issue 1 -> Below is the mapping for OrgUnit to omit/discard the OrgUnits with NO underlying OrgUnit Detail nodes

Mapping for Issue 2 -> OrgUnitDetails mapping to cater for multiple start and end dates for the same OrgUnit

Request clarification before answering.
Hello Sushanth,
What you are doing is everything right just add two mapWithDefault in the last two input nodes of useOneasMany.
See what is happening here, in your main node "OrgUnits" on the receiver side you are using createIf which is creating SUPPRESS in your node. That means that the node will create for OrgUnit which is not having OrgUnitDetails but it will not populate in the output. It is getting suppressed.

And when you do the mapping of your OrgUnit the OrgUnit which does not have the OrgUinitDetails is not able to find the context where it should repeat because that is getting null (If you see the display queue at "OrgUnitDetails"). just add mapWithDetault it will find the correct context. and for the suppressed node it will not populate in output.

Please accept the answer if it gets resolved.
Aman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Great Stuff Aman, thanks for your assistance, very much appreciated you taking time in getting back to me:) I have tried the following and it also worked 🙂 To be honest without having an indepth idea about Context/Queues/Node Functions I was playing around with the mapping and guess what it worked like a magic - ROFL!

Hi Aman,
I trust you are well. Just on the fix that I implemented ( i.e. to NOT display OrgUnit's with NO underlying OrgUnitDetails and to display the multiple OrgUnitDetails with varying start and end dates for a given OrgUnit correctly) is causing some problems when we have missing elements in the Source Structure. I would greatly appreciate if you or other SAP Integration experts can shed some light on this.
<OrgUnits>
<OrgUnit>11111111</OrgUnit>
</OrgUnits>
<OrgUnits>
<OrgUnit>33333333</OrgUnit>
<OrgUnitDetails>
<StartDate>2022-12-01</StartDate>
<EndDate>9999-12-31</EndDate>
<OrgLevel>U</OrgLevel>
<ShortName>SAPHR</ShortName>
<Name>SAP HCM SYSTEM</Name>
<LongDescription>SAP HUMAN CAPITAL MANAGEMENT</LongDescription>
<ParentOrgUnit>22222222</ParentOrgUnit>
<MasterCostCentre>00000123451000</MasterCostCentre>
</OrgUnitDetails>
</OrgUnits>
<OrgUnits>
<OrgUnit>44444444</OrgUnit>
<OrgUnitDetails>
<StartDate>2022-12-01</StartDate>
<EndDate>2022-12-31</EndDate>
<OrgLevel>S</OrgLevel>
<ShortName>SAPINT</ShortName>
<Name>SAPINTERATION</Name>
<LongDescription>SAP Integration PIPO</LongDescription>
<ParentOrgUnit>44444444</ParentOrgUnit>
<MasterCostCentre>00000123541000</MasterCostCentre>
<ManagingPosition>44444441</ManagingPosition>
</OrgUnitDetails>
<OrgUnitDetails>
<StartDate>2023-01-01</StartDate>
<EndDate>2022-12-31</EndDate>
<OrgLevel>S</OrgLevel>
<ShortName>SAP PI</ShortName>
<Name>SAP INTERATION</Name>
<LongDescription>SAP PIPO Integration</LongDescription>
<ParentOrgUnit>44444444</ParentOrgUnit>
<MasterCostCentre>00000123541000</MasterCostCentre>
</OrgUnitDetails>
</OrgUnits>
<OrgUnits>
<OrgUnit>55555555</OrgUnit>
<OrgUnitDetails>
<StartDate>2022-12-03</StartDate>
<EndDate>9999-12-31</EndDate>
<OrgLevel>S</OrgLevel>
<ShortName>SAP BASIS</ShortName>
<Name>SAP BASIS SYSTEM</Name>
<LongDescription>SAP SYSTEM ADMINISTRATION </LongDescription>
<ParentOrgUnit>55555555</ParentOrgUnit>
<MasterCostCentre>00000130861000</MasterCostCentre>
<ManagingPosition>55555551</ManagingPosition>
</OrgUnitDetails>
</OrgUnits>
<OrgUnits>
<OrgUnit>88888888</OrgUnit>
<OrgUnitDetails>
<StartDate>2023-01-03</StartDate>
<EndDate>9999-12-31</EndDate>
<OrgLevel>S</OrgLevel>
<ShortName>SAP CRM S</ShortName>
<Name>SAP CRM SYSTEMS</Name>
<LongDescription>SAP CUSTOMER RELSHIP MGMT SYSTS</LongDescription>
<ParentOrgUnit>88888888</ParentOrgUnit>
<MasterCostCentre>00000123991000</MasterCostCentre>
<ManagingPosition>88888888</ManagingPosition>>
</OrgUnitDetails>
</OrgUnits>
<OrgUnits>
<OrgUnit>99999999</OrgUnit>
</OrgUnits>
For example, In the above source structure for OrgUnit '44444444' we have two child OrgUnitDetails with varying start and end dates and for the first OrgUnitDetails child node the ManagingPosition is displayed ok (i.e. 4444441) at the Target but for the second OrgUnitDetails we have no ManagingPosition element in Source but it's displaying the ManagingPosition 55555551 which belongs to the next OrgUnit '55555555'.
Also note that, I have set the context of all the elements under OrgUnitDetails to 'OrgUnits' and these elements from source are mapped via SplitByValue to their respective target elements.


| User | Count |
|---|---|
| 7 | |
| 5 | |
| 5 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.