Skip to Content

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

where condition in message mapping

Hi,

I'm facing the problem with message mapping on PI. I have a source message in which is a table included.

For every line in that table I need to create a line in the target structure table but only when one of the fields in that source table is populated.

The source structure looks like this:

item (0..unbounded)

ProductCode (1..1)

UnitPrice(0..1)

The target structure looks like this:

item (0..unbounded)

FieldName(0..1)

FieldValue(0..1)

For every item of the souce message I need to create a targed item where FieldName is a constant and FieldValue is a UnitPrice value from source message. But I don't want to create target item for empty UnitPrice values.

I tried to use node finction Remove context, so my mapping looked like this:

UnitPrice --> RemoveContext --> item

Constant --> FieldName

UnitPrice --> FieldValue

This is working for source strucuture where all UnitPrice fields are populated. But if there are 5 source items and only 3 last UnitPrice fileds of them are polulated, then the target structure have 3 items created, but first 2 FieldValue fileds are blank and the last one has the value of the third source UnitPrice field. So the mapping gets first 3 values of source UnitPrice field and not the last 3 as needed.

Please, is there a solution in graphical MM or do I have to use XSLT or Java/ABAP mapping?

Thanks for any help!

Former Member
Former Member replied

Hi,

you could do it like this:

UnitPrice -> removeContext -> exists -> createIf -> item

UnitPrice -> removeContext -> splitByValue -> FieldValue

Regards

Patrick

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