cancel
Showing results for 
Search instead for 
Did you mean: 

Message mapping help needed

Former Member
0 Kudos

I am trying to map target based on a condition. Meaning I want to map E1EDKA2(1..99999) of DESAD01 Idoc to ShipTo(0..1) node if E1EDKA2-PARVW = WE.

I tried all the variations with creatIf and formatByExample but I couldn't able to get it working.

Here is the target XML structure

<Delivery>

<Header>

<ShipmentNumber>1234</ShipmentNumber>

<BOLNumber>ABDC</BOLNumber>

<ShipTo>

<Name>XYZ</Name>

</ShipTo>

<SoldTo>

<Name>XYZ</Name>

</SoldTo>

</Header>

<LineItems>

</LineItems>

</Delivery>

Thanks

Suman

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

I found a better way of doing this...

/ns0:MT_XML_Delivery/Delivery/Header/ShipmentNumber=/DESADV01/IDOC/E1EDK07/VBELN /ns0:MT_XML_Delivery/Delivery/Header/BOLNumber=/DESADV01/IDOC/E1EDK07/BOLNR /ns0:MT_XML_Delivery/Delivery/Header/ShipTo=createIf(stringEquals(removeContexts(/DESADV01/IDOC/E1EDK08/E1EDKA2/PARVW), const(value=WE))) /ns0:MT_XML_Delivery/Delivery/Header/ShipTo/Name=/DESADV01/IDOC/E1EDK08/E1EDKA2/NAME1

Thanks for all who tried to help me.

Suman

SudhirT
Active Contributor
0 Kudos

Hi,

Try with this advance UDF code.

for(int i = 0;i<E1E.length;i++)
{
 if(PAR<i>.equals("WE"))
  result.addValue("");
}

There will be two inputs first the segment E1E and the another is PAR field with same context as of parent segment E1EDKA2 and map this with shipTo field.

Try with this and let us know the result.

Thanks!

Former Member
0 Kudos

Hi Sarvesh,

I don't know what is the significance of checking 1 = 1. Anyway I could able to resolve the issue by my self. Thank you very much for taking time to help me.


/ns0:MT_XML_Delivery/Delivery/Header/ShipmentNumber=/DESADV01/IDOC/E1EDK07/VBELN 
/ns0:MT_XML_Delivery/Delivery/Header/BOLNumber=/DESADV01/IDOC/E1EDK07/BOLNR 
/ns0:MT_XML_Delivery/Delivery/Header/ShipTo=createIf(stringEquals(/DESADV01/IDOC/*E1EDK08*/E1EDKA2/PARVW, const(value=WE))) 
/ns0:MT_XML_Delivery/Delivery/Header/ShipTo/Name=replaceString(/DESADV01/IDOC/E1EDK08/E1EDKA2/PARVW, /DESADV01/IDOC/E1EDK08/E1EDKA2/PARVW, /DESADV01/IDOC/E1EDK08/E1EDKA2/NAME1) 
/ns0:MT_XML_Delivery/Delivery/Header/ShipTo/AccountNumber=/DESADV01/IDOC/E1EDK08/E1EDKA2/PARTN 

XI/PI is really strange. It needs to have that PRVW in the first field mapping, even though it is not being used. I just replaced PARVW with the NAME1 and mapped to name. For the ShipTo, I set E1EDK08 (next higher level structure) as the context.

I think it will take time for me to learn this, as I come from webMethods and XSLT background.

Thanks

Suman

Former Member
0 Kudos

yes you are right my mistake, there was some copy & paste error

Now I see the problem is in setting the right context, because the mapping is easy.

I hope now you can resolve it by yourself.

Regards,

Sarvesh

Former Member
0 Kudos

Hi Sarvesh,

I kind of lost here.

What should be the other input for (equlaS 1).

- Suman

Former Member
0 Kudos

removed

Former Member
0 Kudos

Hi

What the problem you are facing

if you use

source -> equals (constant = WE) - createif -> target

Whats the source structure.

Thanks

Gaurav

Former Member
0 Kudos

Hi Gaurav,

My source structure is Idoc DESADV01. With the following code I don't get anything in the ShipTo/Name.

/ns0:MT_XML_Delivery/Delivery/Header/ShipmentNumber=/DESADV01/IDOC/E1EDK07/VBELN /ns0:MT_XML_Delivery/Delivery/Header/BOLNumber=/DESADV01/IDOC/E1EDK07/BOLNR /ns0:MT_XML_Delivery/Delivery/Header/ShipTo=createIf(stringEquals(/DESADV01/IDOC/E1EDK08/E1EDKA2/PARVW, const(value=WE))) /ns0:MT_XML_Delivery/Delivery/Header/ShipTo/Name=/DESADV01/IDOC/E1EDK08/E1EDKA2/NAME1.

- Suman

Former Member
0 Kudos

Hi Suman

The code given above will create the node ship to when PARVW = WE. You need to map the node which contains the value for Name to Name in target then only value will be passed

Thanks

Gaurav

Former Member
0 Kudos

Hi Gaurav,

I already tried that one, which gave me the same output.

- Suman

Former Member
0 Kudos

Hi,

You need to do your mapping something like this..

Mapping for Segment "ShipTo"

E1EDKA2 ---> equalS (WE) ---> IF Then map constant 1 -


> ShipTo (this will create the segment "ShipTo" only when you have value WE)

Mapping for field "NAME"

E1EDKA2 ---> equalS (WE) ---> IF then map constant 1 --> IF ---> equalS (1) Then NAME1 ---> Remvoecontext -


> SplitByValue -


> NAME

Try this I hope it will help you.

Regards,

Sarvesh

Former Member
0 Kudos

Sarvesh,

Do mean to say some thing like this....


PARVW      \
             -->equalsS \ 		
Constant   /              --> ifWithoutElse --> removeContext --> SplitByValue --> name
[WE]            NAME1   /                                          [Each Value]

This also didn't work.

Thanks,

Suman

Former Member
0 Kudos

removed

Former Member
0 Kudos

removed