cancel
Showing results for 
Search instead for 
Did you mean: 

How to Map

Former Member
0 Kudos

Hi,

I have a source structure which is as shown below

<Add_com ( 0.n)>

< Com_type

<Com_element>

</Add_com>

This maps to Flat structure

<Phone>

<fax>

<Email>

The logic is if the com_ type = 02 map the com_element to email, if 01 map to fax & for 04 map to phone

For some reason, the source is sending com_type but in some cases if there is no value for element, ti does not send the element itself. In one case, i have only email ( no phone & fax)

Now i am ending up with 10 com_type ( diff for phone & fax & email) . For this i have 4, com_element (only email id). When i ran the mapping all them ( phone fax & email)are filled with email address.

can you pls advice, how should i map this so that when the phone & fax value are not there, it should remain blank. Mu current mapping is

if Com_type eq 04

use come_elemet = fax

if com_type eq 02

use com_element as phone

In display queue see 10 com_type & 4 com_element. In the result all of the phone, fax & email has same value.

Regards

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

that's classic with Idoc: when field is empty in ECC, field does not appear in Idoc.

That's why in PI, we have to use node function "mapWithDefault" with default value "" (nothing). In your case, it's on field Com_element.

Regards.

Mickael

Former Member
0 Kudos

Does using the standard function "mapWithDefault" help?

You may use this function after you specify the createIf function( if you are using that one)

rgds

Former Member
0 Kudos

Thanks for the msg. I tried with exists if & map with default. But still i see the 10 & 4 combination only.

Regards

Edited by: harry101_SAP on Oct 17, 2011 3:36 PM

Former Member
0 Kudos

Elaborate what you mean by 10 and 4 combination?

And for which input queue?

What does 10 refer to - communication type or something else?

rgds

Former Member
0 Kudos

Hi,

When the source XML comes i see 10

<ADDITIONAL_COMMUNICATIONS xmlns="">

under which i have 10 <COMMUNICATION_TYPE> with values from 01, 02 to 04

The issue is in some case <COMMUNICATION_ELEMENT is missing ( as there is no value in source & it does not send)

My mapping is directly to Tel, fax & phone. I don't map <ADDITIONAL_COMMUNICATIONS xmlns="">.

The mapping is if 02 map the email 04 phone 01 fax.

With this i get 4 like this

<ADDITIONAL_COMMUNICATIONS xmlns="">

<COMMUNICATION_TYPE xmlns="">02</COMMUNICATION_TYPE>

<COMMUNICATION_ELEMENT xmlns="">XXX@xx</COMMUNICATION_ELEMENT>

</ADDITIONAL_COMMUNICATIONS xmlns="">

rest of 4 are

<ADDITIONAL_COMMUNICATIONS xmlns="">

<COMMUNICATION_TYPE xmlns="">04</COMMUNICATION_TYPE>

</ADDITIONAL_COMMUNICATIONS xmlns="">

Rest 2 are

<ADDITIONAL_COMMUNICATIONS xmlns="">

<COMMUNICATION_TYPE xmlns="">01</COMMUNICATION_TYPE>

</ADDITIONAL_COMMUNICATIONS xmlns="">

Now with this when i look at the queue

I see 10 COMMUNICATION_TYPE & 4 COMMUNICATION_ELEMENT

When the mapping kicks in it is mapping in all 10 to Email address. So for Fax, phone also i am getting the email id

Current mapping is

/ns1:Z_OOOO_XXXX_BUPA_MAINTAIN/IT_BUT020/item[1]/TEL_NUMBER=ifWithoutElse(stringEquals(/ns0:XXXBUSINESSPARTNER/BUSINESS_PARTNERS/ADDRESS_IDS/ADDITIONAL_COMMUNICATIONS/COMMUNICATION_TYPE, const(value=04)), /ns0:XXXBUSINESSPARTNER/BUSINESS_PARTNERS/ADDRESS_IDS/ADDITIONAL_COMMUNICATIONS/COMMUNICATION_ELEMENT, keepss=false)

If COMMUNICATION_TYPE = 04 map to telephone

PriyankaAnagani
Active Contributor
0 Kudos

Hi,

Try with this logic.

if COMMUNICATION_TYPE = constant02>mapwithDefault>COMMUNICATION_ELEMENT--->email

if COMMUNICATION_TYPE = constant04>mapwithDefault>COMMUNICATION_ELEMENT--->phone

if COMMUNICATION_TYPE = constant01>mapwithDefault>COMMUNICATION_ELEMENT--->fax

in each map with default use respective default phoneNum, or mail address or fax no.

Regards,

Priyanka

Former Member
0 Kudos

How about the actual values when it comes from source. With this i would be only able to map with default.

I would like to have actual values map when they are available. When not map with default.

Former Member
0 Kudos

Hi harry101_SAP

Try this.

Commnuication_Type = 02 ................>

Com_element........mapWithDefault.....>ifWithoutElse.........> Email

Commnuication_Type = 01 .......................>

Com_element........mapWithDefault...........>ifWithoutElse.........> Fax

Commnuication_Type = 04 .......................>

Com_element........mapWithDefault...........>ifWithoutElse.........> Phone

This logic create the elements when are available else put the default value.

Regards

Lucho

PriyankaAnagani
Active Contributor
0 Kudos

Hi,

>>>How about the actual values when it comes from source...

when the actual values comes from source side, it'll pass that values as it is. When the source element doesn't exists then only mapWithDefault will pass the default value.

Regards,

Priyanka

Former Member
0 Kudos

In that case, in your map, wherever the element <COMMUNICATION_ELEMENT> occurs, simply add mapWithDefault standard function after it

It should help balancing the queues

rgds

gab