cancel
Showing results for 
Search instead for 
Did you mean: 

Comparison of Header and Line Items

Former Member
0 Kudos

hi,

i have a tag <ShipTo> in the header as well as in the Line Items.

Scenario:

-


1. I am using ZIDOC = ORDERS05 + Extra field "Ship To Site"

This "Ship To Site" code can vary from line item to line item or can be the same for a particular PO.

So Lets say in a PO there are 3 line Items and all the 3 line items can have the "Ship To Site" as "ABCDEF" or "ABCDEF", "EFGHIJ","KLMNOP".

Client's Requirements:

-


Based on the values of the "Ship To Site" code in the line items i have to correspondingly map the header <ShipTo> or line item <ShipTo> address details.

Business Rule:

-


1. If values of all the 3 "Ship To Site" are equal then take the "Ship To" address details and map it to the header <Ship To> address details.

2. Else if all the 3 values are different then leave the header <ShipTo> and fill the line items <ShipTo>

Can we achieve this logic using Graphical Mapping tool?

Thanks,

Tirumal

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

I assume the line items are all in the same context.

You can achieve this through simple graphical mapping.

Use the if then node.

check if lineitem1,lineitem2, lineitem3 are equal,

then, map <ShipTo> to <target-ShipTo>

In order to map the line items if the values are not equal,

If <lineitem1> <lineitem2> <lineitem3>--- != then,

map <lineitem1> to target <lineitem1>.

Similarly for the other two line items.

Regards,

Smitha.

Former Member
0 Kudos

Smitha -

I think your solution sounds simple and straight forward.

I will try to implement and will let you know.

Thanks to everyone for their suggestions.

- Tirumal

Former Member
0 Kudos

Smitha -

I did not think while replying to you earlier.

Question is if we have 10 or more line items logic gets complex. We cannot determine the lineitems.

In that case how can we achieve the solution?

Thanks,

Tirumal

Former Member
0 Kudos

Hi,

<i>We cannot determine the lineitems.</i>

Do you mean that the number of <lineitem> tags is dynamic?

Then, the previous solution would not work. You would have to write a java code.

<i>Question is if we have 10 or more line items logic gets complex</i>

If the tags are static, i.e, if we know for sure, that there are going to be 10 tags of <lineitem> coming in, wecan solve it easily, with the solution i gave above.

Regards,

Smitha.

Former Member
0 Kudos

Smitha -

Yes we don't how many line items we can get. It can vary from vendor by vendor basis too.

PO's change on a daily basis. So we cannot expect the line items in PO to be static always.

Any example how the Java code would like in the above case?

Thanks,

Tirumal

Former Member
0 Kudos

Hi,

If the number of <line items> are dynamic, we could import the entire structure as a queue, count the number of <line items> in it, compare their value.

If equal, you could map it directly to the header <ship-to> else,

do a direct mapping from source <line item> to target <line item>.

Regards,

Smitha.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Tirumal,

You can write a user defined funcation by name isuniqueShipToSite which returns true or false (1 or 0). depending on the value of Ship To Site in the items.

depending on output of that user defined funcation you can calculate Ship To Site in header and in the item node.

Former Member
0 Kudos

Tirumal,

can you give a few more details. From what i understand , your target structure in Message Mapping is the ORDERS idoc. Is your source strucure a custom DT that you have created and used in the outbound interface of a file adpater or any other sender adapter ?

If so , Is your source structure a SINGLE message, (meaning Message cardinality is 1 in source ) with header node defined as a repeating node ?

Regards

Saravana

Former Member
0 Kudos

Saravana -

Target structure is XML and Source is ORDERS IDOC.

Does this help?

Thanks,

Tirumal

Former Member
0 Kudos

pls ignore , looks like u got the solution

Tirumal, if the src target message cardinality is the same, then ur requirement is straightforward i beleive , a simple 1:1 mapping, where in you can write a UDF, pass the ShipTo data in ur line items as an array or something , compare them and if equal , map it to ur target header ShipTo field.

Regards

Saravana

Message was edited by: Saravana Kumar Kuppusamy