cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Issue, I guess I need UDF for this?

Former Member
0 Kudos

Hi All,

I need help from you guys to resolve this issue.

The source message is:

<?xml version="1.0" encoding="utf-8" ?>

- <nr1:MT_UnitEstimateData xmlns:nr1="urn:sce-com:xi:fi:UnitEstimateData">

- <MessagePayload>

- <Record>

<RowID>0001</RowID>

<RecordTypeIndicator>2</RecordTypeIndicator>

<OrderNumber>TD20170736</OrderNumber>

<Operation_Activity>0010</Operation_Activity>

<ControlKey>ZA01</ControlKey>

<Hours>1.2E0</Hours>

<UnitOfWork>H</UnitOfWork>

</Record>

- <Record>

<RowID>0002</RowID>

<RecordTypeIndicator>1</RecordTypeIndicator>

<b> <OrderNumber>TD20170736</OrderNumber></b> <Operation_Activity>0010</Operation_Activity>

- <MaterialCode>

- <Material>

<Material>000000000000000721</Material>

<UnitOfMeasure>EA</UnitOfMeasure>

<QTY>1.000</QTY>

<MovingPrice>108.25</MovingPrice>

<UsageCode>DO</UsageCode>

<LegendCode>RM</LegendCode>

</Material>

</MaterialCode>

</Record>

- <Record>

<RowID>0094</RowID>

<RecordTypeIndicator>1</RecordTypeIndicator>

<b><OrderNumber>TD289</OrderNumber></b> <Operation_Activity>0010</Operation_Activity>

- <MaterialCode>

- <Material>

<Material>000000000000000733</Material>

<UnitOfMeasure>EA</UnitOfMeasure>

<QTY>5.000</QTY>

<MovingPrice>58.52</MovingPrice>

<UsageCode>OH</UsageCode>

<LegendCode>20</LegendCode>

</Material>

- <Material>

<Material>000000000000000720</Material>

<UnitOfMeasure>EA</UnitOfMeasure>

<QTY>0.000</QTY>

<MovingPrice>10250.00</MovingPrice>

<UsageCode>OH</UsageCode>

<LegendCode>10</LegendCode>

</Material>

</MaterialCode>

</Record>

- <Record>

<RowID>0095</RowID>

<RecordTypeIndicator>2</RecordTypeIndicator>

<OrderNumber>TD289</OrderNumber>

<Operation_Activity>0020</Operation_Activity>

<ControlKey>ZA01</ControlKey>

<UnitOfWork>H</UnitOfWork>

</Record>

</MessagePayload>

</nr1:MT_UnitEstimateData>

The Target message being produced for this source message is:

<?xml version="1.0" encoding="UTF-8"?>

<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">

<ns0:Message1>

<ns1:MT_Material xmlns:ns1="urn:sce-com:xi:fi:UnitEstimateData">

<Insert_Material>

<dbTableName action="INSERT">

<table>SCEI_UE_MATERIALS</table>

<access>

<b> <AUFNR>TD20170736</AUFNR></b> <VORNR>0010</VORNR>

<MATNR>000000000000000721</MATNR>

<EINHEIT>EA</EINHEIT>

<MENGE>1.000</MENGE>

<VERPR>108.25</VERPR>

<SORTF1>DO</SORTF1>

<SORTF2>RM</SORTF2>

</access>

<access>

<b> <AUFNR>TD20170736</AUFNR></b> <VORNR>0010</VORNR>

<MATNR>000000000000000733</MATNR>

<EINHEIT>EA</EINHEIT>

<MENGE>5.000</MENGE>

<VERPR>58.52</VERPR>

<SORTF1>OH</SORTF1>

<SORTF2>20</SORTF2>

</access>

<access>

<b> <AUFNR>TD289</AUFNR></b> <VORNR>0010</VORNR>

<MATNR>000000000000000720</MATNR>

<EINHEIT>EA</EINHEIT>

<MENGE>0.000</MENGE>

<VERPR>10250.00</VERPR>

<SORTF1>OH</SORTF1>

<SORTF2>10</SORTF2>

</access>

</dbTableName>

</Insert_Material>

</ns1:MT_Material>

</ns0:Message1>

</ns0:Messages>

Now the issue is here is that I need to create access node for each Material Node in Source. I am doing that using creatif condition and it's wrking fine. It's just that the order number are not coming from right node in access node:

So the right output should be:

<?xml version="1.0" encoding="UTF-8"?>

<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">

<ns0:Message1>

<ns1:MT_Material xmlns:ns1="urn:sce-com:xi:fi:UnitEstimateData">

<Insert_Material>

<dbTableName action="INSERT">

<table>SCEI_UE_MATERIALS</table>

<access>

<b><AUFNR>TD20170736</AUFNR></b> <VORNR>0010</VORNR>

<MATNR>000000000000000721</MATNR>

<EINHEIT>EA</EINHEIT>

<MENGE>1.000</MENGE>

<VERPR>108.25</VERPR>

<SORTF1>DO</SORTF1>

<SORTF2>RM</SORTF2>

</access>

<access>

<b> <AUFNR>TD289</AUFNR></b> <VORNR>0010</VORNR>

<MATNR>000000000000000733</MATNR>

<EINHEIT>EA</EINHEIT>

<MENGE>5.000</MENGE>

<VERPR>58.52</VERPR>

<SORTF1>OH</SORTF1>

<SORTF2>20</SORTF2>

</access>

<access>

<b> <AUFNR>TD289</AUFNR></b> <VORNR>0010</VORNR>

<MATNR>000000000000000720</MATNR>

<EINHEIT>EA</EINHEIT>

<MENGE>0.000</MENGE>

<VERPR>10250.00</VERPR>

<SORTF1>OH</SORTF1>

<SORTF2>10</SORTF2>

</access>

</dbTableName>

</Insert_Material>

</ns1:MT_Material>

</ns0:Message1>

</ns0:Messages>

this is because access node 2 and 3 are coming from one record which has one common order number for two material codes.

Pls advice it's very important and urgent.

Regards,

XIer

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi XIer,

this should work without usage of a UDF. Unfortunately it's hard to describe it in "text form", but I'll try it:

Target field mapping of access node:

Material (set context to Record) --> Exists --> createIf --> RemoveContexts --> Header

--> As a result your queue after Remove Contexts should look similar like this:

[SUPPRESS]

000000000000000721

000000000000000733

000000000000000720

[SUPPRESS]

Target field mapping of AURNR element:

useOneAsMany with the following input parameters:

- OrderNumber (set context to Record) --> useOneAsMany 1. parameter

- Material (set context to Record) --> Exists --> createIf --> useOneAsMany 2. parameter

- Material (set context to Record) --> Exists --> createIf --> useOneAsMany 3. parameter

Continue to work with the result of useOneAsMany --> removeContexts --> SplitByValue (Each value) --> AUNR

--> As a result of SplitByValue (Each value) you should have repeated the order number of the record you've two Material elements.

Target field mapping of MATNR should be 1:1 mapping from source to target.

Maybe there's an easier solution but this one should work. If not, please let me know.

Best regards

Lars

former_member196064
Active Participant
0 Kudos

hmmm...

Instead of the creatif, I think I might try a SplitByValue for this... with a property of eachValue.

Doug -

justin_santhanam
Active Contributor
0 Kudos

Xier,

Did u got the solution for your problem?

raj.

justin_santhanam
Active Contributor
0 Kudos

Xier,

Did u gave the full source for the target produced, or just a sample? Coz I can see only one order number <b>TD289</b> in source.

raj.

Former Member
0 Kudos

Hi Raj,

Theer are two order numbers in the source: TD20170736 and TD289 and they are highlighted as well.

Thanks for looking into this mapping issue..

Regards

Raj

VijayKonam
Active Contributor
0 Kudos

Check if you are properly considering the context changes. If the target node is repeating and the sourse has less nodes, it would replicate them on the target. As such I did not understand the problem here.. since no mapping was mentioned..!!

VJ

Former Member
0 Kudos

VJ,

The mapping is one on one without any other transformations. It's just that I have use CREATIF condition for access node.

material > exits > creatif > access.

other than that everything is one on one.

it's just that the order number is not coming in right order in access nde...

Regards,

XIer

Former Member
0 Kudos

I had a similar problem: you like to have the second field with the same order of the first one. I suggest you to create a User defined function (UDF) of type queue.

input parameter: order number

access node

output parameter: result with the queue of the order number in the right order.

tips: if you have to use the result more than one time Ii suggest you to add change contexts to memorize which order belong to the same access node.

I suggest you to see the following link to learn more about mapping:

Mapping functionality in XI

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9202d890-0201-0010-1588-adb5e89a...

SAP Exchange Infrastructure - Graphical_Mapping

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6658bd90-0201-0010-fbb6-afe25fb3...

SAP Exchange Infrastructure - Graphical Mapping Exercise

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/fd5ebd90-0201-0010-d697-91374d5b...

SAP Exchange Infrastructure - Graphical Mapping - Advanced

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/be05e290-0201-0010-e997-b6e55f95...

SAP Exchange Infrastructure: Mapping Patterns - Understand Context Handling in Message Mapping - Webinar Powerpoint

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f59730fa-0901-0010-df97-c12f071f...

SAP NetWeaver Exchange Infrastructure Mapping Troubleshooting - Webinar Powerpoint

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e01e9400-9e81-2910-20a5-a862945a...

Mapping Lookups a RFC API

XI 3.0 New Mapping Features

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8a57d190-0201-0010-9e87-d8f327e1...

Message was edited by:

Salvatore Quattrocchi