cancel
Showing results for 
Search instead for 
Did you mean: 

SAP XI - Mapping with Contexts

Former Member
0 Kudos

Hi Guys,

We have a problem when mapping with contexts. Couldyou please help.

What we are trying to achieve is if PARVW = X then map name2 to name2. We have done this all the way down the DT_Address. The context on both input values are set to IDOC.

The problem is that when all the fields are in a particular segment occurence then it maps perfectly. But on numerous occurrences of E1EDKA1 various fields are missing i.e.name2 or pstl2 etc. What we want to happen is if the field doesn’t exist in that particular occurrence then just leave blank and don’t map. What is happening instead is XI keeps looking for this field and maps the first occurrence it can find of it. So we end up with like 6 occurrences of the same thing.

Is their a way to specify that only map the fields if it is within the same occurrence as the qualifier. So basically Name2 follows PARVW to the same occurrence.

Also is their a way of making it so we don’t get

Name

Name

Name

Id

Id

Id

Address

Address

Address

And instead get

Name

Id

Address

Name

Id

Address

Name

Id

Address

Thanks people

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Thanks for your input.

It was a little to do with the context but in the end I had to put another element in the target structure. So it went

Customer 0-unbounded

customerAddress 1-1

Details 0-1

ETC 0-1

ETC 0-1

I mapped the customer to E1EDKA1

I mapped customer address to a constant

and the details I ampped as before but with no context.

This seemed to work.... I have no idea why but it did work. If anybody could explain the why, I would appreciate it.

Former Member
0 Kudos

Hi,

I am not sure if I got the question right. If yes: Have you already considered working with "mapwithdefault"?

Set the context of PARVW back to KA1, after the "equals" (=) insert a removecontext. Insert "mapwithdefault" after NAME2.

What it does, is that for every empty context a default value is inserted. So the sequence of the name2 queue keeps as it is.

MfG,

Christoph

former_member187339
Active Contributor
0 Kudos

Hi,

What is the context of PARVW in the graphical editor for this mapping

if PARVW = X then map name2 to name2

I think you have changed it to IDOC. Change it to E1EDKA1 and try.

You yourself can debug by giving test values in the messages tab and taking the disply queue of each function in the mapping. Just try changing contexts of the functions.

Regards

Suraj