Skip to Content
avatar image
Former Member

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!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 01, 2008 at 09:51 AM

    Hi,

    you could do it like this:

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

    UnitPrice -> removeContext -> splitByValue -> FieldValue

    Regards

    Patrick

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 01, 2008 at 10:32 AM

    Thanks a lot. Now it's working perfect. I tried to add that condition on item node and that was my problem.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 01, 2008 at 10:43 AM

    Hi,

    try this mapping:

    UnitPrice>exists>createIf>removeContexts>item(Target)

    Constant-->FieldName

    UnitPrice-->FieldValue

    Regards,

    Sankar Choudhury

    Add comment
    10|10000 characters needed characters exceeded