cancel
Showing results for 
Search instead for 
Did you mean: 

PARVW/PARTNER_Q if - then - else

Former Member
0 Kudos

Good morning all,

Wrapping up an IDoc to XML mapping and have a single field (in two maps) that's giving me problems.

(In SHPMNT05 to xml) for target @DESTour requirement is to provide the value of NAME 4 if it exists, if not then the value of PARTNER_ID when PARTNER_Q =  WE

(In ORDRSDP to xml) for target @DEST we are looking to provide the value of ILNNR if it exists, if not then the value of PARTN, when PARVW = WE

I cannot get the if/then/else logic to work for the target @DEST in either map. I'm sure some of you have an idea on this one. Hopefully we can collaborate on a solution for each map!

root node for SHPMNT mapping:

@DEST target mapping logic:

root node for ORDRSP mapping:

@DEST target mapping logic:

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Sorry - forgot to include my output error!

My root node (NCRA_DESTINATIONS) is created if PARTNER_Q = WE.

Because I have qualified the target root element as if PARTNER_Q= WE  the subsequent attributes all pull data from PARTNER_Q=WE and have been mapped directly without issue as below.

I've introduced the equalsS qualifier as you've requested and as shown below:

My requirement is to send NAME4 of PARTNER_Q=WE. If it does not exist, send PARTNER_ID of PARTNER_Q=WE

My output will give me NAME4 when it exists:

But will not produce PARTNER_ID when NAME4 does not exist:

ambrish_mishra
Active Contributor
0 Kudos

Hi Rich,

I did a quick check. Since you have used createIf you will have suppress values for non-WE records. for the target field @DEST, you simply can map like below. The queues will align by default this way.

NAME4 and PARTNER_ID should be same context as E1EDKA1. Also, note that if either of NAME4 and PARTNER_ID is not populated in ECC/IDoc, the tag won't come to PI at all.

This should work!

Ambrish

Former Member
0 Kudos

Hi Ambrish,

Tried your logic without any luck as below. Context of PARTNR and NAME4 are both E1EDKA1 with results as displayed. Any idea what could be keeping the value from passing?

result with NAME4 existing:

result with NAME4 missing and value exists for PARTNR:

ambrish_mishra
Active Contributor
0 Kudos

Hi Rich,

Since you are checking for NAME4 exists, its true and hence null is getting populated since NAME4 takes precedence.

I mentioned as below:

Also, note that if either of NAME4 and PARTNER_ID is not populated in ECC/IDoc, the tag won't come to PI at all.

So you have to delete the tag/element NAME4 and then test.

If in case you get blank values from real IDoc from ECC(you will have to check if NAME4 not null) instead of NAME4 exists but that is highly unlikely.

Hope it is clear!

Ambrish

Former Member
0 Kudos

Hi Ambrish,

My requirement is to pass the value of NAME4 if it is present in the IDoc from ECC. If that field is not present in the IDoc pass the value of PARTN. 

PARTN will always exist in the IDoc, but we prefer to use NAME4 when available.

I'm not sure I understand the check if NAME4 not null logic you mentioned above. What goes between not and the if/then/else block if checking for value of null in IDoc?

Thanks!

ambrish_mishra
Active Contributor
0 Kudos

Rich,

You can apply the mapping as below:

Ambrish

Former Member
0 Kudos

Ambrish - can't thank you enough. Your last post works flawlessly. Appreciate the help!

ambrish_mishra
Active Contributor
0 Kudos

Glad to help!

Answers (2)

Answers (2)

ambrish_mishra
Active Contributor
0 Kudos

Hi Rich,

The root node mapping looks ok. You need to add logic in the mapping for @DEST.

something like below:

you can map partner_id instead of PARTN. You can use mapWithDefault if any of these may not be populated.

Hope it helps!

Ambrish

Former Member
0 Kudos

Hi Ambrish,

I've implemented your logic as below without luck. What context should PARTNERQ be along with the contexts of NAME4 and PARTNER_ID?:

rajasekhar_reddy14
Active Contributor
0 Kudos

Hi Rich,

What error are you facing? you need to add PARTNER_ID when PARTNER_Q =  WE logic in if then else block,current you are mapping PARTNER_ID but not checking condition PARTNER_Q =  WE.

Add this condition and share error screen shot (mapping test screen shot).

Thank you