cancel
Showing results for 
Search instead for 
Did you mean: 

RemovingContext only for One level(Message Mapping)

arunneerolil
Contributor
0 Kudos

Hi,

Is it possible to remove context only for one level?

For Eg:If I apply [RemoveContext] function to <Item>

I will get {A1,A2,B1,B2,C1,C2,C3,C4}

<SourceRoot>

<A>

<Item r="a">A1</Item>

<Item r="b">A2</Item>

</A>

<A>

<Item r="a">B1</Item>

<Item r="b">B2</Item>

</A>

<A>

<Item r="a">c1</Item>

<Item r="b">c2</Item>

<Item r="c">c3</Item>

<Item r="d">c4</Item>

</A>

</SourceRoot>

But I need only those coming under a particluar <A> .

Like {B1,B2}.

Any way to do this?

Can anyone help.

Thanks in Advance

Message was edited by: Chemmanz

Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor
0 Kudos

When you want to increase the context reference by one level, you right click on the source element and set the context here instead of using the function removeContext.

But in your case there are only two levels for item, so it would not make any difference.

Regards

Stefan

arunneerolil
Contributor
0 Kudos

Hi,

I was just trying to give an example. In my real case

SOURCE - INVOIC01 IDoc

TARGET - cXML Structure for Invoice.

When it goes to Line item level the complexity comes.

A similar situation as i explained needs to be solved.

[REMOVECONTEXT] helped me a lot.

But I this situation I want to restrict it to a single level.

For Ex:

<INVOIC02>

<IDOC>

<EIEDP01>

<EIEDP02 QUALF="001">.. </EIEDP02>

<EIEDP02 QUALF="002">.. </EIEDP02>

..

<EIEDP02 QUALF="0xx">.. </EIEDP02>

...

</EIEDP01>

<EIEDP01>

<EIEDP02 QUALF="001">.. </EIEDP02>

<EIEDP02 QUALF="002">.. </EIEDP02>

..

<EIEDP02 QUALF="0xx">.. </EIEDP02>

...

</EIEDP01>

....

</IDOC>

</INVOIC02>

1.<EIEDP01>

<=== mapped directly to ==> <InvoiceDetailOrder>

Then internal things are organized differently in

<InvoiceDetailOrder> compared to IDoc element<EIEDP01>

Ex:

I want to take all the <EIEDP02>s coming under one line Item <EIEDP01>

<EIEDP02> cannot be mapped diectly to cXML element. It can be done only after checking it's own attribute QUALF.

For this I applied [REMOVECONTEXT], but i am getting all the QALF values.

I need to restrict it to <EIEDP01> level.

Regards

Chemmam

stefan_grube
Active Contributor
0 Kudos

Now I see. The problem is not the EIEDP02, this has the correct context reference. It is QUALF. As attribut the context reference is EIEDP02.

When you have


QUALF 
       = - createIf - InvoiceDetailOrder
  001 /

Then right click on QUALF and set the context reference to EIEDP01.

I hope, I have understood the problem correctly.

Regards

Stefan

arunneerolil
Contributor
0 Kudos

Hi Grube,

You solved it!

Thanks a lot.

)

Regards

Chemmam

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

You should be able to do that, but for that one need to know how to select a particular <A> tag. For the mapping of <Item>, we have combine a condition where in it checks for the <A> condition and then removes all other item values.

Could you post the required condition for what <A> tag needs to be selected.

Thanks,

Renjith

arunneerolil
Contributor
0 Kudos

Hi,

I will explain it more clearly

Source Structure

=================

<SourceRoot>

<A>

<Item r="a">A1</Item>

<Item r="b">A2</Item>

</A>

<A>

<Item r="a">B1</Item>

<Item r="b">B2</Item>

</A>

<A>

<Item r="a">c1</Item>

<Item r="b">c2</Item>

<Item r="c">c3</Item>

<Item r="d">c4</Item>

</A>

</SourceRoot>

Target Structure

=================

<DestRoot>

<AA>

<AAItem></AAItem>

<AA>

</DestRoot>

Mappings

=========

<SourceRoot> <====> <DestRoot>

<A> <====> <AA>

<Item> <== only those items Where r="a" is to be mapped to ===> <AAItem>

I tried like this

If r->[REMOVECONTEXT]->[Equals "a"]->then Map <Item> to <AAItem>

After [REMOVECONTEXT] it will produce {a,b,a,b,a,b,c,d} in all the three rows.

Which produces unwanted results.

I want only {a,b} in row1.

I want only {a,b} in row2.

I want only {a,b,c,d} in row3.

That is I want to restrict [REMOVECONTEXT] to only one level, not for the complete XML Document.

Regards

Chemmam

stefan_grube
Active Contributor
0 Kudos

Can you post the requested target XML?