cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Problem . or help in UDF

Former Member
0 Kudos

Hi...

I am having problem in mapping.

I am having 3 messages in the source structure and 1 message in the target structure. 3:1 mapping.

Source Messages:

Message1: Warehouse Details(plant name,warehouselocation)

Message2:Supplier Details(suppid,suppname,leadtime,matname,cost)

Message3:Input(matname,plant,unit,item,itemname,ReqQty,OrderQty,Cost,suppid,suppname,leadtime,date,warehouseloc)

Target Message:

Output

If the Availability field in Message3 !=0, then it should map warehouseloc of message 1 to the Output mesage. or else it should map 0 to the warehouse and map message 2 items to the output message.

Source messages are 0:unbounded.

Could you please help me out in this issue. or else can you please tell how to write the userdefined function for that.

Below is the structure.

Source Message:

-


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

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

<ns0:Message1>

<ns1:getWareHouseDetailsResponse xmlns:ns1="http://DefaultNamespace">

<getWareHouseDetailsReturn>

<Plant>

<plantName/>

<wareHouseLocation>W001</wareHouseLocation>

</Plant>

</getWareHouseDetailsReturn>

</ns1:getWareHouseDetailsResponse>

</ns0:Message1>

<ns0:Message2>

<ns2:GetPreferredSuppliersResponse xmlns:ns2="http://tempuri.org/">

<ns2:GetPreferredSuppliersResult>

<ns2:Supplier>

<ns2:SupplierId>S001</ns2:SupplierId>

<ns2:SupplierName>TRW</ns2:SupplierName>

<ns2:LeadTime>1111</ns2:LeadTime>

<ns2:MaterialName>M001</ns2:MaterialName>

<ns2:Cost>1000</ns2:Cost>

</ns2:Supplier>

</ns2:GetPreferredSuppliersResult>

</ns2:GetPreferredSuppliersResponse>

</ns0:Message2>

<ns0:Message3>

<ns3:MT_Output xmlns:ns3="http://BlockTest">

<Material>

<Matname>M001</Matname>

<Plant>P001</Plant>

<Unit>KG</Unit>

<Item/>

<Itemname/>

<ReqQty>5</ReqQty>

<AvailQty>0</AvailQty>

<Cost/>

<Suppid/>

<Supname/>

<LeadTime/>

<Date>12.05.2008</Date>

<OrderQty>0</OrderQty>

<WarehouseLoc/>

</Material>

<Material>

<Matname>M002</Matname>

<Plant>P002</Plant>

<Unit>PC</Unit>

<Item/>

<Itemname/>

<ReqQty>5</ReqQty>

<AvailQty>5000</AvailQty>

<Cost/>

<Suppid/>

<Supname/>

<LeadTime/>

<Date>12.05.2008</Date>

<OrderQty>0</OrderQty>

<WarehouseLoc/>

</Material>

<Pcost/>

<Tcost/>

<Ocost/>

</ns3:MT_Output>

</ns0:Message3>

</ns0:Messages>

Target Message:

-


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

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

<ns0:Message1>

<ns3:MT_Output xmlns:ns3="http://BlockTest">

<Material>M001</Material>

<Plant>P001</Plant>

<Unit>KG</Unit>

<Item></Item>

<Itemname></Itemname>

<ReqQty>5</ReqQty>

<AvailQty>0</AvailQty>

<Cost>1000</Cost>

<Suppid>S001</Suppid>

<Supname>TRW</Supname>

<LeadTime>1111</LeadTime>

<Date>12.05.2008</Date>

<OrderQty>0</OrderQty>

<WarehouseLoc>0</WarehouseLoc>

</Material>

<Material>M002</Material>

<Plant>P002</Plant>

<Unit>KG</Unit>

<Item></Item>

<Itemname></Itemname>

<ReqQty>5</ReqQty>

<AvailQty>0</AvailQty>

<Cost>1000</Cost>

<Suppid/>

<Supname/>

<LeadTime/>

<Date>12.05.2008</Date>

<OrderQty>0</OrderQty>

<WarehouseLoc>W001</WarehouseLoc>

</Material>

</ns3:MT_Output>

</ns0:Message1>

</ns0:Messages>

Edited by: leelaratnam morampudi on Oct 14, 2008 1:13 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I think there is no need to use UDF, you can achive this by using IF function.

to make your mapping simple, in your message mapping on MT_Output, right click your mouse and click on duplicate subtree. you will now have two structure in your target.

first one is for if AvailQty != 0 then warehouseloc of message 1 to the Output mesage

and second one is for if AvailQty = 0 now map 0 to the warehouse and map message 2 items to the output message.

try this and let us know if you face any issues.

Answers (0)