Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

to Use first occurrence of ItemLocation only in Target - Advice please


I am stuck in 1 place in message mapping. I have to Use only the first occurrence of ItemLocation only as detailed below.

Oh I am on PI 7.1.1

My Target structure is a flat structure.

My current mapping attempt is below-

The If condition gives me the correct match with Item Header and Item Location.

The above ID gives me all the 3 occurrences of 3 values from the source side.

Tried multiple mappings (collapse / remove and misc) but nothing is giving me the correct result.

Here copy value 0 always gives me the first itemLocation -> ItemID -> ID

For 1st Header Record, it is ok

But that is not ok for 2nd Header Record.

I have been through the forum but not finding anything that is helping…

Please advice. I am stuck.




Right click on your source field i.e. ( ID field under itemlocation) and set the context to Item master.

then collapse context which will take first occurrence from each item location.

Then use split by value to map it to target field.

your mapping should be :

ID (context-> item master) -> collapse context -> split by value -> target field

Having said that, i didn't understand the logic behind index/if then condition. How are you finding the matching Location for the header? is there a field in both the segments to compare?

If you just apply index function on Location and Header nodes then i'm not sure how you can get a matching record. This will always return the first occurrence as true.

If you get a matching location segment as second occurrence, then your mapping shouldn't work. I would suggest you check the logic to find the the matching location segment.

0 View this answer in context

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question