cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP CDS view: use @DefaultAggregation: #FORMULA without @Analytics.query: true

Former Member
0 Kudos

Dears,

I would like to create a consumption or composite ABAP CDS view with calculations that behave as a formula i.e. has to be calculated after the operands have been determined by aggregation or calculation. It should never be aggregated. Later on the front-end (BW or CDS query) the result of the calculations should change according the characteristics selected by the user (this is possible with Calc view calculated columns)

The problem is that calculation on CDS views by default are done at records level and aggregated, hence my idea was to use the @DefaultAggregation: #FORMULA annotation to get the desire result. However I only managed to make it work for abap cds queries (@Analytics.query: true), while for other CDS views, I got the "Element contains unsupported aggregation #FORMULA [Analytics]" error.

is this annotation supported by other types of ABAP CDS view? I would like to make those calculations before the queries.

Regards,

Antonio


Accepted Solutions (0)

Answers (2)

Answers (2)

leogannon
Discoverer

I found a resolution to this (just in case anyone is still looking for one)

if you use the annotation @AnalyticsDetails.query.formula you can enter an expression

e.g.:

    @Aggregation.default: #FORMULA
    @AnalyticsDetails.query.formula: 'NDIV0(OrderDelivery.Volume / OrderDelivery.OrderCountDec ) * 100'
    @AnalyticsDetails.query.decimals: 2
    1                           as Percentage

I hope this helps as I spent a while searching for a resolution to this and all I found was this unanswered post.

Leo

sreehari_vpillai
Active Contributor
0 Kudos

did you find any solution ? I also have the same issue.

Sreehari