Hello,
I am trying to send our SHIP TO fields from the IDOC into the Item level Ship To on our outgoing XML document. In our IDOC the field E1EDKA1 when PARVW = WE this segment relates to SHIP TO. But in some cases the fields are stored on the item level of the IDOC in E1EDPA1 (also where PARVW = WE).
I need to set up my mapping to create the Item level Ship To on my outbound XML for each item. If E1EDPA1 contains the fields I use them, but if not then I need to use E1EDKA1 fields.
My current mapping is not returning the expected results:
E1EDPA1 (context ITEM) PARVW (context E1EDPA1)------------- | equalsS ---------IF----Then-----------------------ShipToLocation Constant "WE" ----------------------- Else | PARVW (context E1EDKA1)------------- | equalsS--------IF -------Then Constant "WE" -------------------- | E1EDKA1 (context Document)
Then I repeat this IF for each field required for the ShipToLocation.
Any ideas?
Thanks,
Matt
Any other ideas?
I need to show the header level ShipToLocation if it exists on every line item. But if it does not exists then I need to show the line item ShipToLocation from each line to its corresponding line item on the new document.
Thanks,
Matt
Hello,
Thanks for the response.
The unexpected result is no ShipToLocation node being created.
The 2nd IF/Then returns:
IFWithoutElse: In0 IFWithoutElse:Out <null> <null> (grey) <false> SUPPRESS (grey) <false> SUPPRESS (grey) <false> <null> (white) <false> <null> (dark grey) <true> +blank+ (white) <true> +blank+ (white)
Does that help?
Thanks,
Matt
Edited by: Matthew Herbert on Oct 6, 2010 11:11 PM
use node function exists:
PARVW (context E1EDPA1)------------- | equalsS ----*exists* ---IF----Then-----------------------ShipToLocation Constant "WE"
Thanks for the suggestions.
I have tried using "Exists" without any luck. I will try using RemoveContext and CollapseContext returns the fields from other E1EDKA1 segments even if they do not have PARVW = "WE". So I might get the Fax Number stored in the Buyer Address stored in the Ship To Address for the outbound document.
This might help clarify the problem. My inbound IDOC may look like either of the following documents:
Document 1:
<IDOC>
<E1EDKA1 SEGMENT="1">
<PARVW>AG</PARVW>
...Buyer Address...
</E1EDKA1>
<E1EDKA1 SEGMENT="1">
<PARVW>LF</PARVW>
...Ship From Location...
</E1EDKA1>
<E1EDKA1 SEGMENT="1">
<PARVW>WE</PARVW>
...Ship To Location...
</E1EDKA1>
<E1EDP01>(Items)
</E1EDP01>
</IDOC>
Document 2:
<IDOC>
<E1EDP01>(items)
<E1EDPA1>
<PARVW>LF</PARVW>
...Item 1 Ship From Location...
</E1EDPA1>
<E1EDPA1>
<PARVW>WE</PARVW>
...Item 1 Ship To Location...
</E1EDPA1>
</E1EDP01>
<E1EDP01>
<E1EDPA1>
<PARVW>LF</PARVW>
...Item 2 Ship From Location...
</E1EDPA1>
<E1EDPA1>
<PARVW>WE</PARVW>
...Item 2 Ship To Location...
</E1EDPA1>
</E1EDP01>
</IDOC>
As you can see. I need to check for PARVW = "WE" every time whether the address is stored at the header (E1EDKA1) or at the item (E1EDPA1) level. And then if it is at the item level, I need to be sure that Item 1 has its corresponding Ship To Address.
Does that help?
Thanks,
Matt
Thanks for all the suggestions.
Here's what I learned.
The equalsS mapping tool does not throw a "false" if the field does not eist. It gives a <null> which then causes the IF to fail. So I need to check to see if the field exists before I can check to see if PARVW equalsS WE.
I also needed a useOneAsMany to replicate the Header Address fields for each line item.
Then I had to create a UDF to determine whether or not to create the "Communication" node for Phone, Fax and Email because this node does not exist every time the Address node is created.
Altogether a complicated mapping for a rather simple concept.
Thanks to all.
Matt
Add a comment