Skip to Content
0

ABAP CDS - Aggregation

Jun 14, 2017 at 06:21 AM

135

avatar image

Hi,

I need to aggregate a particular measure on the fly based on the selected attributes - Is it possible using @DefaultAggregation: #SUM? Or we need to use SUM() and GROUP BY?

What is the difference between the two?

Example,

@DefaultAggregation: #SUM

vbap.klmeng as OrderQty


OR

SUM(vbap.klmeng) as OrderQty


Thanks,
Remya

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

1 Answer

Sean Zhang
Jun 24, 2017 at 04:09 PM
1

The annotation will be used by framework or tools, e.g. the Analytical Engine or TCode RSRT,which means the aggregation behavior will be decided by the annotation you specified.

in order to reach the similar behavoir in your own code, you have to interpretated the annotation by your self. however, if you're directly use the CDS in your ABAP code, then the SUM, groupby is needed in your Open SQL.

Best Regards,

Sean

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hi Sean,

Thanks a lot for the response, it makes sense to me.

So if my CDS is used by Analytics tools, the annotation will take care of the aggregation.

But If I am using my CDS in another CDS, then SUM() is required for aggregation.

Please correct my understanding.

Thanks,
Remya

0

Yes, that's also my understanding.

0