cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping problem of Child Node elements as per Parent Node conditions

Former Member
0 Kudos

Hi,

I have an IDOC to SOAP scenario,I have to map the following fields of IDOC,

E1EDPT1 (0..999..)

_TDID (0..1)

_ E1EDPT2 (0..999..)

_ TDLINE (0..1)

Whenever I have the element TDID = Z011, I have to map the element TDLINE to the target Message Type AVL_QTY , which is as below (any one)

ITEM_TEXTS (0..unbounded)

_ ITEM_TEXT (0..unbounded)

|_ AVL_QTY (0..1)

I have done a graphical mapping where the Node ITEM_TEXTS is created only if the above condition is met, ITEM_TEXT and AVL_QTY are mapped directly to E1EDPT2 and TDLINE.

This works for only one item, it fails for multiple.

Please suggest a solution...

Thanks and Regards,

Rohit.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

TDID-removeContext--ITEM_TEXTS

Thanks

Amit

Former Member
0 Kudos

Hi,

I have tried with removeContext, it works but if there are two items and the condition is met in both the items, then both the resultant nodes are displayed in the 1st Item's output structure. i.e. in the output First Item will have 2 ITEM_TEXTS node with the valid values from Item 1 and Item 2 and the Second Item doesnt contain ITEM_TEXTS node.

Thanks and Regards,

Rohit.

Former Member
0 Kudos

Hi,

can u plz provide ur input and desired output xml structure??

and in previous reply i was trying to suggest something like this:

TDID ---removeContext

-


equalS-Ifwithoutelse---ITEM_TEXTS

Constant(Z011)

in else part pass Constant().

Thanks

Amit

Former Member
0 Kudos

Didnt got a full proof solution yet, It fails under multiple E1EDP01, E1EDPT1, E1EDPT2 segments conditions.

The source structure is the standard IDOC ORDERS05, and the relation is between the segments TDID of E1EDPT1 and TDLine segment of E1EDPT2.

Below is the Output XML structure, where AVL_QT will be repeated multiple times when the condition is met.

<xsd:element name="CONTRACT_ITEM" minOccurs="0" maxOccurs="unbounded">

<xsd:complexType>

<xsd:sequence>

<xsd:element name="AVL_QT" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />

</xsd:sequence>

</xsd:complexType>

</xsd:schema>

Have tried various combinations of context changes, graphical mappings, UDF's etc.

Can anybody provide a solution?

Thanks and Regards,

Rohit

Former Member
0 Kudos

Hi,

Try this:

Create a udf Execution type: All values of a context

var1, var2 type string.

if(var1[0].equals("Z011"))

for(int i=0;i<var2.length;i++)

{

result.addValue(var2<i>);

}

else

for(int i=0;i<var2.length;i++)

{

result.addValue(ResultList.SUPPRESS);

}

Mapping will be:

1) TDID ---removeContext

-


equalS-Ifwithoutelse---ITEM_TEXTS

Constant(Z011)

2) TDID----

-


UDF-----ITEM_TEXT

TDLINE(change its context)----

3) TDID----

-


UDF---splitbyvalue--AVL_QTY

TDLINE(change its context)----

Note: Context of TDLINE will be E1EDPT1(while mapping right click on TDLINE element and chose its conext).

Thanks

Amit

Former Member
0 Kudos

Hello,

Thanks for the above suggestion!

But still the problem exits.

I have currently mapped the field in such a way that it gives proper solution but every item i.e. E1EDP01 segment must have an E1EDPT1 segment with element TDID = Z011.

Mapping in Text View looks like below:

/ns0:MT_CONTRACT_DOWNLOAD_MOnline/CONTRACT_ITEM/AVL_QT=addCorresponding(removeContexts(index(ifWithoutElse(stringEquals(/ORDERS05/IDOC/E1EDP01/E1EDPT1/TDID, const(value=Z011)), /ORDERS05/IDOC/E1EDP01/E1EDPT1/E1EDPT2/TDLINE, keepss=false), start=1, inc=1, type=0, result)), removeContexts(ifWithoutElse(stringEquals(/ORDERS05/IDOC/E1EDP01/E1EDPT1/TDID, const(value=Z011)), /ORDERS05/IDOC/E1EDP01/E1EDPT1/E1EDPT2/TDLINE, keepss=false)), result)

UDF for addCorresponding method:

int flg=0;

for (int i=0; i<indexes.length; i++)

{

if(! indexes<i>.equals("1"))

{

result.addValue(tdTexts<i>);

}

else

{

if(flg == 0)

{

result.addValue(tdTexts<i>);

flg = 1;

}

else

{

result.addContextChange();

result.addValue(tdTexts<i>);

}

}

Suppose if there are 3 items, the above condition is met in 1st and 3rd item, and if the 2nd item has TDID = Z008, then in the output i get three item values with the TDLINE values in the first two items itself, it doesnt recognise that 2nd item hasnt matched the condition.

Thanks and Regards,

Rohit.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Put the node function splitByValue(each value) in both the mappings of ITEM_TEXT & AVL_QTY .

-Supriya.

Former Member
0 Kudos

Hi,

Try to do context changes for E1EDPT2 -TDLINE feild to E1EDPT1. When TDID = Z011 and its have multiple TDLINE values, all these shown in single context and use split by value fucntion to acheive your mapping rule.

you may need to populate this node |_ ITEM_TEXT (0..unbounded) as per TDLINE values.

Hope this helps

Cheers

Veera

Former Member
0 Kudos

Hi,

Put removeContext node function in the mapping of ITEM_TEXTS and try again.

Out this function befor the ITEM_TEXTS in the mapping.

-Supriya.