cancel
Showing results for 
Search instead for 
Did you mean: 

Certain elements end up with values from different context

Former Member
0 Kudos

We have a problem in which data from one context is ending up in a different context in xml output from PI.

Either the element Foo or the element Bar will contain data. They are elements of a data type ORDER.  There are 12 ORDERS in the message.

The first 6 have values for Foo, but not Bar.  The 7th has Bar, but not Foo.  The rest have Foo but not Bar.

The output xml is correct for the first 6, but at the 7th  the value in Bar is correct, but Foo has the value from the next ORDER being processed.

The 8th, 9th, 10th and 11th ORDERS have the Wrong value for Foo.  It is the value from the next ORDER being processed.

The 12th has no value for Foo nor Bar.  The last Foo was given to the 11th.

When I display the queue in ESB, I see that the list for Foo has neither <null> nor SUPPRESS for any of the rows.  The displayed queue for Bar on the other hand has <null> in the lineup whereever a Foo value exists and a real value whereever a Foo value doesn't exist.

So, Bar has no problem. The value matches up with the appropriate ORDER.

The only difference I see between the external message for Foo vs Bar in ESB is that Bar is directly under ORDER whereas Foo is actually three elements under FooKey.  FooKey is directly under ORDERS.

Both FooKey and Bar have occurrence = '0..1'.  Under FooKey, Foo is '1..1'.

One other thing - in the XSD, Foo and Bar are choice data types.  I believe that PI 7,1 level 9 doesn't support choice data types, but we are not receiving an error.  AND the current structure does work for Bar.

Any suggestion as to why the queue for Foo does not have null placeholders when Foo does not exist in the input xml; whereas the queue for Bar does, will be appreciated.

One other thing, when I add an empty FooKey tag, the output xml is correct.

The 'display queue' shows SUPPRESS in the positions where there is no Foo.

Any assistance is greatly appreciated.  We are testing with our customer and near go-live.

I believe that this must be a common problem and my humble knowledge of SAP PI must not be sufficient to discern the cause.

Thanks.

John

Accepted Solutions (0)

Answers (1)

Answers (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hi John,


Any suggestion as to why the queue for Foo does not have null placeholders when Foo does not exist in the input xml; whereas the queue for Bar does, will be appreciated.

The context of Bar is already set to Orders, you need to set the context of Foo to match it. This can be done in message mapping by right-clicking on the source field and then mouse over the context option, for example below

Regards,

Mark

Former Member
0 Kudos

Hi Mark,

That fixed it.  Thanks a lot.

It also fixed some misconceptions I had about context.

John