cancel
Showing results for 
Search instead for 
Did you mean: 

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

former_member596513
Participant
0 Kudos

Hi,

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.

Regards,

Archana

Accepted Solutions (1)

Accepted Solutions (1)

former_member191435
Contributor
0 Kudos

Hi Archana,

Can you please show mw your target structure once..

Thanks,

Sreenivas

former_member596513
Participant
0 Kudos

Hi Sreenivas,

My target structure is totally flat with 1...unbounded as below.

The target field is WarehouseID and this same logic will need to be mapped to other mandatory fields.

Regards,

Archana

former_member191435
Contributor
0 Kudos

Use Below mapping u can get it...

make sure that map item master ---> access

and consider field3 as ID and take the context as Item Master.

Let me know still if you face an issue...

Thanks,

Sreenivas

former_member596513
Participant
0 Kudos

My issue is that at the level of the ID field, i am unale to link it back to the item location position that i want.

My test data is for example-

former_member191435
Contributor
0 Kudos

do need wareid values as 1004 and 1006 ...

if it is true use the mapping provided by me

former_member184720
Active Contributor
0 Kudos

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.

former_member596513
Participant
0 Kudos

i got it

I am giving details in a sec ... thank you Sreenivas and Haressh

former_member596513
Participant
0 Kudos

I know my mapping is only half...more work to be done but it is getting there.

but thank you guys

am going to ask more...

what is happening is that there will always be the below structure sequence in the Source-

ItemMaster - 1...unbounded

     ItemMasterHeader - cardinality 1

     ItemLocation - 0...unbounded

          ItemID - 0..unbounded

               ID Field - 1

Now there can be more than 1 ItemMaster records with the above sequence

For the Target, It is always a flat structure

All the ItemMaster have to be mapped to the target access in a flat sequence

access 1...unbounded

     WarehouseID - 1

     ProductGroup - 1

     Field3  - 1

Now there are 3 fields that are to be mapped from ItemLocation to the target access and all the 3 fields on target side are mandatory

I am anyways makring the XML validation as active in sender and receievr agreement.

However, the requirement is defined as ALWAYS map the FIRST occurrence of ItemLocation within the ItemMaster record ONLY.

ItemLocation in Source is 0..unbounded

I still have to check if the ItemLocation is not received, then raise an exception.

Can i still use ifExists function?

However, as the XML validation will be activated, the mandatory fields when not mapped with a value during runtime will raise a mapping exception.

Additionally, i also have to check if the itemLocation is received BUT the source fields taht are mapped to the target mandatory fields are empty, then raise an exception and NOT map with default.

i hope the above makes sense.

I am currently also doing various scenario tests at the same time so make sure that the mapping should work in all scenarios and raise an exception only where defined.

Please advice

former_member191435
Contributor
0 Kudos

check below thread

http://scn.sap.com/thread/3204486

Thanks,

Sreenivas

Answers (0)