cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Issue

Former Member
0 Kudos

Hello Guys,

I have a mapping issue. Well actually I need to be confirmed if what I am thinking is correct.

I have the following structure:

Source:

Orderheader (1..1)

-OrderParty (1..1)

--ShipToParty (0..1)

---Party (1..1)

-


ReceivingContact (0..1)

-


ListOfContactNumber (0..1)

-


ContactNumber (1.. unbounded)

-


ContactNumberValue (1..1)

-


ContactNumberTypeCoded (1..1)

Target:

Header (1..1)

--ShipTo (0..1)

---Telf1 (0..1)

I cannot change any structure (I can use node functions, I know) and need to map from the source ContactNumberValue where ContactNumberTypeCoded='TelNr' to

the target Telf1.

So I created the following mapping:

IF ContactNumberTypeCoded='TelNr' THEN map ContactNumberValue to Telf1

The ContactNumberTypeCoded has got the following values in the queque:

Email

FaxNumber

TelNr

The end result in the queue for Telf1 is the Email address.

So I started wondering why and to my opnion it has got to do something about the nodes, if we go back to the node:

ContactNumber where the 2 fields, ContactNumberValue and ContactNumberTypeCoded are in, has got an occurences of 1 to unbounded and the target only has 0..1 So thats the problem, the target can only receive one value and just takes the first one.

If that's correct then I have another question, why did the map didn't work correctly? Because I say in the mapping look for the right value en give me back that value and map it.

When I change the context for ContactNumberValue, ContactNumberTypeCoded to ListOfContactNumber which occurs (0..1) then it works fine. Is that because of the difference of occurences between source and target?

Best regards,

Guido

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

This seems to be a problem with contexts only. I can clearly tell you after goin thro' the payload.

Can you paste your input payload here.

Regards,

Shri

Former Member
0 Kudos

This is the complete

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

<Order>

<OrderHeader>

<OrderParty>

<ShipToParty>

<Party>

<PartyID>

<Identifier>

<Agency>

<AgencyCoded>AssignedByBuyerOrBuyersAgent</AgencyCoded>

</Agency>

<Ident>DEB7</Ident>

</Identifier>

</PartyID>

<NameAddress>

<Name1>Name 1 ShipTo</Name1>

<Name2>Name 2 ShipTo</Name2>

<Name3>Name 3 ShipTo</Name3>

<Street>Street ShipTo</Street>

<PostalCode>Postalcode ShipTo</PostalCode>

<City>City ShipTo</City>

<County>N/A</County>

<Region>

<RegionCoded>Other</RegionCoded>

</Region>

<Country>

<CountryCoded>DE</CountryCoded>

</Country>

<ReceivingContact>

<Contact>

<ContactID>

<Identifier>

<Agency>

<AgencyCoded>Other</AgencyCoded>

<AgencyCodedOther>N/A</AgencyCodedOther>

</Agency>

<Ident>N/A</Ident>

</Identifier>

</ContactID>

<ContactName>Guido K</ContactName>

<ListOfContactNumber>

<ContactNumber>

<ContactNumberValue>foo@foobar.com</ContactNumberValue>

<ContactNumberTypeCoded>EmailAddress</ContactNumberTypeCoded>

</ContactNumber>

<ContactNumber>

<ContactNumberValue>0123</ContactNumberValue>

<ContactNumberTypeCoded>FaxNumber</ContactNumberTypeCoded>

</ContactNumber>

<ContactNumber>

<ContactNumberValue>00 11 333333</ContactNumberValue>

<ContactNumberTypeCoded>TelephoneNumber</ContactNumberTypeCoded>

</ContactNumber>

</ListOfContactNumber>

</Contact>

</ReceivingContact>

</Party>

</ShipToParty>

</OrderParty>

</OrderHeader>

<OrderDetail>

<snip>

</OrderDetail>

<OrderSummary>

<TotalAmount>

<MonetaryValue>

<MonetaryAmount>255.4</MonetaryAmount>

<Currency>

<CurrencyCoded>EUR</CurrencyCoded>

</Currency>

</MonetaryValue>

</TotalAmount>

</OrderSummary>

</Order>

Message was edited by:

G. Koopmann

Message was edited by:

G. Koopmann

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

As I have understood your problem:

You need to map ContactNumerValue from source to Telfr in target structure, only when ContactNumberTypeCoded in source has Value 'TelNr'.

You could perform following mapping for this:

ContactNumberTypeCoded(Context changed to ListOfContactNumber) equals TelNr constant ............... if

ContactNumberValue(Context ListOfContactNumber) .... Then -> Trim funtion -> RemoveContext -> SplitByValue -> Target TelFr

In given example, it should work as follows:

ContactNumberTypeCoded would have a queue with only one context without any Context Changes as follows:

EmailAddress

FaxNumber

TelephoneNumber

ContactNumberValue would have queue as follows originally:

foo@foobar.com

0123

00 11 333333

If condition would be successful only for TelephoneNumber and on output side you should receive only the telephone number.

00 11 333333

If there are any suppressed values, they would be removed by Trim function.

Try this and let me know if it works.

Thanks,

Bhavish

    • Award points if comments are useful

Former Member
0 Kudos

Hi,

<i>When I change the context for ContactNumberValue, ContactNumberTypeCoded to ListOfContactNumber which occurs (0..1) then it works fine. Is that because of the difference of occurences between source and target?</i>

Because in input file it is coming multiple times and out of them one of the value is TelNr.

Hi Raj,

May be 3rd position is not always telephone number. It could come any sequence.

Thanks

Shubhankar

Former Member
0 Kudos

The Telephone-number, email and faxnumber is comming in different order indeed. So that's not the solution.

<b>When I change the context for ContactNumberValue, ContactNumberTypeCoded to ListOfContactNumber which occurs (0..1) then it works fine. Is that because of the difference of occurences between source and target?</b>

<i>Because in input file it is coming multiple times and out of them one of the value is TelNr.</i>

Is this the reason why it's going wrong? Input has got it multiple times and the output can just receive one item?

Best regards,

Guidio

Former Member
0 Kudos

Hi Guidio,

Please read page 23 to 26 from below link and I think Bhavish has given code and it should work.

<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/be05e290-0201-0010-e997-b6e55f9548dd">https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/be05e290-0201-0010-e997-b6e55f9548dd</a>

Thanks

Shubhankar

former_member187437
Contributor
0 Kudos

Hi

If have understood your query correctly,

I dont think its because of the difference of occurence value between source and target fieid.

In your first mapping definition,

<i>IF ContactNumberTypeCoded='TelNr' THEN map ContactNumberValue to Telf1

The ContactNumberTypeCoded has got the following values in the queque:

Email

FaxNumber

TelNr</i>

Each element 'Email' , 'FaxNumber' and 'TelNr' have a context change in between. So the result queue of if function is suppress, cc, suppress,cc, telnr.

So only the first context is considered. So i think the telnr node should not be generated at all in the target, since its not mandatory. I dont know why you got that node in the target.

In the second case, after you removed the contexts, the result queue will be suppress, suppress, telnr. All in a single context. So all of these values are considered and the third element telnr is mapped to the target field. Hence you got the correct output.

Former Member
0 Kudos

I need the phone number and that's not the issue.

When there is no Context change, I get the first value in TELF1 in this case the e-mail address.

When I have no context change the result in the Queue for Telf1 is indeed:

Suppress -Suppress - Telnr and the end result is that Telf1 is not mapped, again it takes the first item in the queue.

When I change the context to a level were the node is just occuring one time I do get my result. If did it for ShipToParty and also for ListOfContactNumbers and in both cases I get the right result.

So either it has got someting to do with the context or the occurrences between source and target, to my opion.

justin_santhanam
Active Contributor
0 Kudos

Koopmann,

As per your example I'm <b>assuming</b> that you will have only three type of contacts also Telephone number will be the third contact. If my assumption is wrong then let me know.

<ListOfContactNumber>

<ContactNumber>

<ContactNumberValue>foo@foobar.com</ContactNumberValue>

<ContactNumberTypeCoded>EmailAddress</ContactNumberTypeCoded>

</ContactNumber>

<ContactNumber>

<ContactNumberValue>0123</ContactNumberValue>

<ContactNumberTypeCoded>FaxNumber</ContactNumberTypeCoded>

</ContactNumber>

<ContactNumber>

<ContactNumberValue>00 11 333333</ContactNumberValue>

<ContactNumberTypeCoded>TelephoneNumber</ContactNumberTypeCoded>

</ContactNumber>

</ListOfContactNumber>

Try this:

ContactNumberValue->RemoveContext->CopyValue[3]----->target.

If the above logic doesn't helps then reply back.

raj.