cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to do the total or sub total in RAP custom query

kunal_chandra
Explorer
0 Kudos
3,466

I have a requirement which I have developed using RAP custom query. It has just 10 fields including one currency field.Report is working fine. Now I got an additional requirement to show total or subtotal based on currency field. I tried annotation @default aggregation #sum but it is dumping and I also tried UI.presentationvariant: total,GroupBy but it is not working .

Please suggest how to achieve this in RAP custom Query.

Regards,

Kunal

 

ABAP RESTful Application Programming Model 

Accepted Solutions (0)

Answers (1)

Answers (1)

rammel_sapdev
Participant
0 Kudos

Hi,

Have you found a solution for this? I saw this from the documentation https://help.sap.com/docs/abap-cloud/abap-rap/annotating-aggregate-functions-in-cds but it was not working for me when using unmanaged query. We have a similar requirement to have a subtotal and wondering if it is possible.

Jagtar
Participant
0 Kudos
Yes it is possible using @Default aggregation #sum on top of filed where you want total and then do grouping on another field where you want subtotal.
Jagtar
Participant
0 Kudos
Yes it is possible using @analytics.dataCategory: #CUBE at header level and @Default aggregation #sum on top of filed where you want total and then do grouping on another field where you want subtotal.
Jagtar
Participant
0 Kudos
Example you want subtotal by id on amount filed . Apply grouping on ID and apply @Default aggregation #sum on amount filed.