cancel
Showing results for 
Search instead for 
Did you mean: 

OData group by query option

johannes_albrecht01
Discoverer
0 Kudos

Hi,

I recently created an OData Service with the Netweaver Gateway Service Builder (SEGW), but unfortunately the grouping of properties does not seem to work as I know it from XS OData services.

When I call the url below on an XS OData, I get a result where A and B are aggregated by YEAR

.../odata/CA_CFA.xsodata/cfa?$select=A,B,YEAR

This grouping does not work the same when I call the same $select parameter on the OData service I defined in SEGW.

The properties A and B have the semantic set to "aggregate" and YEAR is set as a dimension.

Is there a way to achieve the same behaviour with the ABAP OData service as with the XS OData service?

Thank you!

Accepted Solutions (1)

Accepted Solutions (1)

ChandraMahajan
Active Contributor
0 Kudos

Hi,

$select will return the field specified in resultset in OData query. for e.g. http://services.odata.org/OData/OData.svc/Products?$select=Rating,Price

aggregation is not supported by OData version 2.0 on which SAP Gateway is based on.

It will be available in OData 4.0 as mentioned here OData Extension for Data Aggregation Version 4.0

you need to implement the grouping logic on client side. refer this discussion on similar lines Get a count of a linked collection using OData and LINQ - Stack Overflow

Regards,

Chandra

johannes_albrecht01
Discoverer
0 Kudos

Hi Chandra,

thanks for your answer. I was not specific enough in my question.

My problem was more a backend problem of implicitly aggregating certain columns when selecting these columns with the $select url parameter as it is possible with XS OData and the setting "aggregates always". In the meantime I found out how to achieve the same behaviour with the ABAP OData Service and SADL.

Still it is good to know what is about to come with OData 4.0.

Thanks a lot.

Cheers,

Johannes

kammaje_cis
Active Contributor
0 Kudos

This might help.

Answers (0)