Skip to Content
0
Jun 23, 2020 at 08:06 AM

ABAP CDS View Default Aggregation #FORMULA

2808 Views

Dear SAP consultants,

I am trying to use the ' @DefaultAggregation: #FORMULA ' aggregation in a CDS View but I cannot make it work.

The business requirement is the following: We have the quantity ordered and the quantity sold and we have to provide the percentage of the goods sold out of the ordered quantity.

For the Quantity Ordered and Quantity Sold I used '@DefaultAggregation: #SUM' and for the calculated column I used the below code snippet taken from another post:

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

While testing the CDS, I am getting '1' across the whole output for the calculated column.

Could you please advise what am I missing?