Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
Showing results for 
Search instead for 
Did you mean: 
Active Contributor


In this blog post, I will show you how to create an analytical table using a CAP OData service. Please note that this blog post is focused on List Report, and not Analytical List Report (ALP).

Recently, I was tasked with displaying an analytical table based on an OData V4 service built with CAP. While I was able to display the data on the table using some annotations, I encountered an issue with displaying totals at the bottom. Unfortunately, this issue is still unresolved.

Nevertheless, I would like to share what I have accomplished so far and would appreciate any advice on how to address this issue.

Update on June 2023 - With the help of the OSS support team, I figured out how to display the total.

Analytical table with OData V4 (total is displayed)

Analytical table with OData V2 (total is displayed)


CAP Project

Below is the CAP project with minimum data models and annotations for showing an analytical table. The code is available at GitHub.

Data model

The data model is created with `cap add samples` command and an entity `BooksAggregate` was created on top of it. This entity will be used for displaying analytical tables.
namespace my.bookshop;

entity Books {
key ID : Integer @title: 'ID';
title : String @title: 'Title';
category: String @title: 'Category';
stock : Integer @title: 'Stock';

entity BooksAggregate as projection on Books {


The service simply exposes the two entities in read-only mode.
using my.bookshop as my from '../db/data-model';

service CatalogService {
@readonly entity Books as projection on my.Books;
@readonly entity BooksAggregate as projection on my.BooksAggregate;


The following annotations were added to make the analytical table work. The first block is for OData V4, and the second is for OData V2.
using CatalogService from './cat-service';

//aggregation annotations
// v4
annotate CatalogService.BooksAggregate with @(
Aggregation.ApplySupported: {
GroupableProperties: [
Aggregation.CustomAggregate #stock: 'Edm.Int32'
stock @Analytics.Measure @Aggregation.default: #SUM

// v2
annotate CatalogService.BooksAggregate with @(
sap.semantics: 'aggregate'
ID @sap.aggregation.role: 'dimension';
category @sap.aggregation.role: 'dimension';
title @sap.aggregation.role: 'dimension';
stock @sap.aggregation.role: 'measure';



List Report (V4)

A List report was created on OData V4 service with the table type set to `AnalyticalTable`.
      "targets": {
"BooksAggregateList": {
"type": "Component",
"id": "BooksAggregateList",
"name": "sap.fe.templates.ListReport",
"options": {
"settings": {
"entitySet": "BooksAggregate",
"controlConfiguration" : {
"" : {
"tableSettings": {
"type": "AnalyticalTable"

With above settings, an analytical table will be displayed but without the total.

Analytical Table without the total

However, if you click on the header of the "Stock" column, you will find the "Totals For: Stock" button. This is a good indication that the aggregate feature is working properly.

Totals for button

To display the total by default, the final step is to add the UI.PresentationVariant annotations:
annotate CatalogService.BooksAggregate with@(
UI: {
PresentationVariant: {
Total: [
Visualizations: [

Finally, the analytical table is displayed with the total at the bottom.

Analytical Table (V4) with the total

List Report (V2)

Next, another List report was created on OData V2 service with the table type set to `AnalyticalTable`.
    "pages": {
"ListReport|BooksAggregate": {
"entitySet": "BooksAggregate",
"component": {
"name": "sap.suite.ui.generic.template.ListReport",
"list": true,
"settings": {
"tableSettings": {
"type": "AnalyticalTable"
"dataLoadSettings": {
"loadDataOnAppLaunch": "always"

When you execute the application, you will see the total is displayed at the bottom.

Analytical Table (V2) with the total



In order to display the total for an analytical table served by OData V4, the important annotation is UI.PresentationVariant. However, it is not yet documented in SAPUI5 SDK. I hope this post will be helpful to anyone looking to achieve similar functionalities as the analytical tables in OData V2 using OData V4.
Labels in this area