cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping IDOC to XML - Context problem

Former Member
0 Kudos

Hello,

I am trying to map up to 2 segments from an ORDERS IDOC into one segment in my PO XML.

In the target PO XML document both segments UltimateCustomer and ParticipatingDealer are under the heading SalesOrderData.

<Header>

...<SalesOrderData>

.......<UltimateCustomer>

............<Name>

............<address>

....................<street>

....................<city>

......<ParticipatingDealer>

............<Name>

............<address>

....................<street>

....................<city>

So I only create the SalesOrderData segment if at least one of the two E1EDKA1 segments exists where PARVW = ZO or ZU then I want to repliate those segments into their target fields.

ZO - Ultimate Customer

ZU - Participating Dealer

When both values exist I am only getting the data from the first segment (ZO or ZU) but not both. With the following mapping.

If PARVW (IDOC Context) = ZO or PARVW (IDOC Context) = ZU ...CreateIf...SalesOrderData

If PARVW = ZO...CreateIf...UltimateCustomer.

If PARVW = ZU ...CreateIf...ParticipatingDealer.

I tried many context combinations to get both segments to appear but the only time I could get them both to appear is if I force the creation of SalesOrderData. (Constant[]...SalesOrderData). This of course creates a blank node when ZO and ZU do not exist. Which is not a good solution.

Any suggestions?

Thanks,

Matt

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Try this-

If PARVW (IDOC Context) = ZO or PARVW (IDOC Context) = ZU ...collapseContexts...SalesOrderData

If PARVW = ZO.then PARVW (without Else.)....UltimateCustomer.

If PARVW = ZU then PARVW (without Else.)......ParticipatingDealer.

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks to both of you!

CollapseContext was the solution here. By using CollapseContext in SalesOrderData I was able to process both sub elements separately from the IDOC context.

It seems to me that any time I change the context to IDOC I should be able to move to that level. But when the higher segment (SalesOrderData) was created with the "ZO" E1EDKA1 segment I was unable to access the "ZU" E1EDKA1 segment for the sub elements.

Thanks again.

Matt

Former Member
0 Kudos

chk this:

Mapping of "Header":



PARVW(context IDOC)----
--------------------equals ----
Constant(ZO)
-------------------------------------OR-----IfWithoutElse(Constant()----then)--------collapseContext------HEADER
PARVW(context IDOC)----
--------------------equals ----
Constant(ZU)

Mapping of "UltimateCustomer":



PARVW----
--------------------equals ----IfWithoutElse(Constant()----then)-----removecontext---------UltimateCustomer
Constant(ZO)

Mapping of "ParticipatingDealer":



PARVW----
--------------------equals ----IfWithoutElse(Constant()----then)-----removecontext---------ParticipatingDealer
Constant(ZU)

Mapping of "name" under "UltimateCustomer":



PARVW----
---------------equals ----IfWithoutElse(Name(from source)---then)--removecontext----splitbyvalue(each value)--Name
Constant(ZO)

In the same way (like "Name" field mapping) proceed for the rest of the target fields....