Skip to Content
0

OData Service - Using a filter on a Dependent Entity Set

Nov 03, 2016 at 08:43 AM

130

avatar image
Former Member

Hello All,

I have an issue facing me which I am trying to resolve with respect to OData.

I tried searching the existing forums, however I have read mixed replies.

So I have 2 entities - SalesOrder and SalesPos.

These 2 entities are connected with a Navigation SalesNav and cardinality 1:M

I would like to be able to get all SalesOrder header info and SalesPos Items info for all Sales Orders where

- The Customer number is 10 or 20

- The Item number is 30 or 40

And I am using here the expand functionality.

So, initially since I am a novice in OData, I felt the URI should look like....

http://blahblahblah.blah.de:7000/sap/opu/odata/SALESINFO?$filter=Order eq '10' or '20'&$expand=SalesNav&$filter=Item eq '30' or '40'

However, I checked up the OData Conventions, and then I learnt the Properties of the dependent entity are to be addressed in a different way. My URI should actually be

http://blahblahblah.blah.de:7000/sap/opu/odata/SALESINFO?$filter=Order eq '10' or '20'&$expand=SalesNav&$filter=SalesNav/Item eq '30' or '40'.

I need to use the Qualified field name.


However, when I tried with this URI .. I get an error message that "Left hand side of the expression has a false cardinality".

I tried debugging .and noticed while evaluating the Filter expression, if we use a Qualified Filter, the system expects the Cardinality to be 1:1.

I found that a little weird.. but nevertheless I trid I tried it out. I changed the cardinality to 1:1 and surprisingly it worked.

So I was able to use filters on both Entity Sets.

So now my Question:

a) Does the current version of SAP Netweaver Gateway simply not support the $filter expression on the second Entity Set in a Navigation ? If the answer is no... then I would wonder why it supports it with the Cardinality 1:1.

b) Is there some workaround.. some way we can transfer Search conditions for the second Entity Set ?

Thanks for your inputs.

Regards

Shadab.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers