Hi All,
I have a CDS view in Eclipse which is used in an OData gateway service. The CDS has two amount fields which use the annotation "@Aggregation.default: #SUM" and it all works great. In the CDS I then needed to add a virtual field with a filter, so I used the virtualElement annotation and call an ABAP method to set a filter on a particular field.
After adding the virtual element the service runs but raises an exception in standard SAP that complains the CDS is analytical. After some research I removed the aggregated fields as I figured they were turning it into an analytical CDS. The service then runs with the virtual element but I have lost the aggregation functionality!
So the dilemma is in the CDS I need aggregation on two amounts fields and I also need a virtual element with a filter. But it looks like you cannot have both in the same CDS, you can only have one or the other.
I have not checked yet but maybe the aggregation can be replaced with a SUM and GROUP-BY but its such a shame.
Any thoughts would be appreciated.