Skip to Content

xsodata and sap:aggregation

Hi:

I have a stupid simple SAP Cloud Platform Calculation View that has three dimensions (Employee, Calendar Year, and Calendar Month) and one measure (Number of calls). I have also created a .xsodata file to expose this as an OData service. In the .xsodata file, I've added the following:

annotations {
	enable OData4SAP;
}

I am seeing the sap:label in the EDMX file, but am I also able to add/see the sap:aggregation-role, too?

Thanks in advance, Ian.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Dec 27, 2017 at 05:23 PM

    The key is to specify the aggregation in the .xsodata file with the 'aggregates always' clause.

    The complete service description is:

    service namespace "CCO.com.sap.nacco.service" { 
           "CV_CONTACT_BYMONTH_V2" as "ContactByMonthSet" with ("CALMONTH", "CALYEAR", "CONTACT_COUNT", "ContactType", "FullName") key generate local "GenID" aggregates always (SUM of "CONTACT_COUNT");
    }
    
    annotations {
    		enable OData4SAP;
    }
    
    Add comment
    10|10000 characters needed characters exceeded

  • Dec 21, 2017 at 08:48 AM

    If you want aggregation to your properties, put this annotation above the property :

    @DefaultAggregation: #SUM

    Regards,

    Joseph

    Add comment
    10|10000 characters needed characters exceeded