cancel
Showing results for 
Search instead for 
Did you mean: 

Help in mapping with 'createIf' node function

Ash_ok
Contributor
0 Kudos

Hi gurus !

I am using a 'createIf' node function to create a node in the target if a source field equates to a particular value. Normally, it would mean that only those fields in the source node that satisfies the condition of the 'createIf' would be available to be mapped to the target node's fields. However, I would like a field from another node in the source to be mapped onto the same target node's fields.

Source (IDoc - DELVRY03)-

<E1EDL20>

......

<E1EDL22>

...

<VSBED_BEZ>Trial testing</VSBED_BEZ>

</E1EDL22>

.......

<E1ADRM1>

<PARTNER_Q>WE</PARTNER_Q>

.....

<NAME1>xxxx</NAME1>

<NAME2>xxxx</NAME2>

......

</E1ADRM1>

/TargetNode = createIf(equalsS(/partner_q), Constant('WE')))

/TargetNode/name1=/E1ADRM1/NAME1 - working

/TargetNode/name2=/E1ADRM1/NAME2 - working

/TargetNode/vsbed=/E1EDL22/VSBED_BEZ - field not displayed in output at all

Currently '/TargetNode/vsbed' is not being output at all, leave alone a blank entry, though the test shows the value appearing correctly under 'Display Queue'. Is there any trick that I could try ?

Cheers,

Ashok.

Accepted Solutions (1)

Accepted Solutions (1)

Ash_ok
Contributor

Hi Matias,

I solved the problem using the 'Sort' node function with some inspiration from Stefan Grube who wrote a blog on the 'Sort' function.

The field 'PARTNER_Q' contains the partner function. I sorted this field in descending order, got the ship-to party partner function 'WE' as the first one and mapped the field.

R005=createIf(stringEquals(SplitByValue([type=Each value]sort([comparator=Lexicographical (case insensitive), order=descending]removeContexts(/DELVRY03/IDOC/E1EDL20/E1ADRM1/PARTNER_Q=))), const([value=WE]))).

Thanks for putting time and effort on this .

Cheers,

Ashok.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Ashok !

You could try to use the "removeContext" function against the source field.

Hope it helps.

Regards,

Matias.

Ash_ok
Contributor
0 Kudos

Hi Matias,

I tried the 'removeContext' before mapping VSBED_BEZ but to no avail.

Any other help ?

Cheers,

Ashok.

Former Member
0 Kudos

Ashok,

This appears to be a context change issue (and not a createif issue). Check your context queue to make sure that the VSBED_BEZ is at the same context level.

You mainly use the createif function to trigger the creation of the node, then map your fields.

Regards,

Simon

Ash_ok
Contributor
0 Kudos

Hi Simon,

The context in the mapping of the field 'PARTNER_Q' in the createif node function and that of field VSBED_BEZ are in the same context of E1EDL20. But no target field.

Any other help ?

Cheers,

Ashok.

Former Member
0 Kudos

Hi Ashok !

Could you try to send more data about your case? I tryied to reproduce it here, but here it works fine.

Thanks,

Matias.

Ash_ok
Contributor
0 Kudos

Hi Matias,

The relevant bits of the source IDoc - DELVRY03 is as below -

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

<DELVRY03>

<IDOC BEGIN="1">

<EDI_DC40 SEGMENT="1"> </EDI_DC40>

<E1EDL20 SEGMENT="1">

<E1EDL22 SEGMENT="1">

<VSTEL_BEZ>xxxx</VSTEL_BEZ>

<VKORG_BEZ>yyyy</VKORG_BEZ>

<INCO1_BEZ>zzzz</INCO1_BEZ>

<VSBED_BEZ>Pre 1200 hours Satur</VSBED_BEZ>

</E1EDL22>

<E1EDL21 SEGMENT="1">

<E1EDL23 SEGMENT="1"> </E1EDL23>

</E1EDL21>

<E1EDL18 SEGMENT="1"> </E1EDL18>

<E1ADRM1 SEGMENT="1"> </E1ADRM1>

<E1ADRM1 SEGMENT="1">

<PARTNER_Q>WE</PARTNER_Q>

<PARTNER_ID>0000000010</PARTNER_ID>

<LANGUAGE>EN</LANGUAGE>

<NAME1>aaaa</NAME1>

<STREET1>bbbb</STREET1>

<POSTL_COD1>ccc cccc</POSTL_COD1>

<CITY1>dddd</CITY1>

<COUNTRY1>gg</COUNTRY1>

</E1ADRM1>

<E1ADRM1 SEGMENT="1"> </E1ADRM1>

<E1ADRM1 SEGMENT="1"> </E1ADRM1>

<E1EDT13 SEGMENT="1"> </E1EDT13>

<E1EDL33 SEGMENT="1"> <ALAND>IE</ALAND>

</E1EDL33>

<E1EDL24 SEGMENT="1">

<E1EDL25 SEGMENT="1"> </E1EDL25>

<E1EDL26 SEGMENT="1">

<E1EDL27 SEGMENT="1"> </E1EDL27>

</E1EDL26>

<E1EDL35 SEGMENT="1">

<E1EDL36 SEGMENT="1"> </E1EDL36>

</E1EDL35>

<E1EDL43 SEGMENT="1"> </E1EDL43>

<E1EDL43 SEGMENT="1"> </E1EDL43>

<E1EDL41 SEGMENT="1"> </E1EDL41>

</E1EDL24>

<E1EDL24 SEGMENT="1">

<E1EDL25 SEGMENT="1"> </E1EDL25>

<E1EDL26 SEGMENT="1">

<E1EDL27 SEGMENT="1"> </E1EDL27>

</E1EDL26>

<E1EDL15 SEGMENT="1"> </E1EDL15>

<E1EDL35 SEGMENT="1">

<E1EDL36 SEGMENT="1"> </E1EDL36>

</E1EDL35>

<E1EDL43 SEGMENT="1"> </E1EDL43>

<E1EDL43 SEGMENT="1"> </E1EDL43>

<E1EDL41 SEGMENT="1"> </E1EDL41>

</E1EDL24>

</E1EDL20>

</IDOC>

</DELVRY03>

The mappings are as under -

/Rec005 = createIf(equalsS(/PARTNER_Q), Constant('WE')))

/Rec005/F01=Constant('R005')

/Rec005/F03=/E1ADRM1/POSTL_COD1 - context as E1ADRM1

/Rec005/F12=removeContext(/E1EDL22/VSBED_BEZ) - context as E1EDL20

The relevant target node is as below -

<R005>

<R005F01>R005</R005F01>

<R005F02></R005F02>

<R005F03>ccc cccc</R005F03>

<R005F04></R005F04>

<R005F05></R005F05>

<R005F06></R005F06>

<R005F07></R005F07>

<R005F08></R005F08>

<R005F09></R005F09>

<R005F10></R005F10>

<R005F11></R005F11>

<R005F13></R005F13>

<R005F14></R005F14>

</R005>

Cheers,

Ashok.

Former Member
0 Kudos

Hi Ashok !

I made a mock test using :

/Rec005 = createIf(equalsS(/PARTNER_Q), Constant('WE')))

/Rec005/F01=Constant('R005')

/Rec005/F03=/E1ADRM1/POSTL_COD1 - context as E1ADRM1

/Rec005/F12=removeContext(/E1EDL22/VSBED_BEZ) - context as E1EDL22

note that I used E1DL22 as context for the VSBED_BEZ instead of E1EDL20. and it worked.

Please check this snapshots:

http://matiasdenker.googlepages.com/screen1_ashok.jpg

http://matiasdenker.googlepages.com/screen2_ashok.jpg

http://matiasdenker.googlepages.com/screen3_ashok.jpg

Any news?

Regards,

Matias.

Ash_ok
Contributor
0 Kudos

Hi Matias,

Sorry for the late reply. I was at another client the last couple of days.

Well, I think

/Rec005 = createIf(equalsS(/PARTNER_Q), Constant('WE'))) is incorrect.

Apologies if I've typed it incorrectly ! It should have read -

/Rec005 = createIf(equalsS(/PARTNER_Q), Constant('WE'))) - context as E1EDL20, as only the ship-to party details should be populated in Rec005.

I also found another complication in that if the item category group is 'NLC' / 'TAN', etc. in E1EDL26-PSTYV, it works correctly but fails if the item category group is 'YG05', a batch split item, in E1EDL26-PSTYV.

I have used 'removeContexts' / 'collapseContexts' any number of ways and found that though the 'Display Queue' is showing the correct value, the field is not populated with the value, I'm guessing because of the context E1EDL20 in /Rec005. Is there a solution out there ? Can anything be done ?? Please.

Cheers,

Ashok.