â2025 Oct 02 3:08 PM - edited â2025 Oct 03 12:05 PM
Hello,
I have a freestyle SAPUI5 application which consumes an OData V2 service which I develop using CAP Java with
{
"d":{
"results":[
{
"__metadata":{
"type":"Reporting.VAnalytics",
"uri":"https://myhost.com/odata/v2/reporting/VAnalytics(aggregation'{\"key\":{},\"value\":[\"bookingHour\",\"nonApprovedHour\"]}')"
},
"bookingHour":"516899.1",
"nonApprovedHour":"5303",
"ID__":"aggregation'{\"key\":{},\"value\":[\"bookingHour\",\"nonApprovedHour\"]}'"
}
],
"__count":"1"
}
}
I believe Java stack does not interpret the "@sap.aggregation.role" annotation. I checked the documentations and could not find anything useful.
I'd appreciate any help on how to achieve using SmartTable with AnalyticalTable type consuming an OData V2 service provided by CAP Java.
Annotations:
annotate ReportingCenter.Analytics with @(sap.semantics: 'aggregate');
annotate ReportingCenter.Analytics with {
employeeTeamID .aggregation.role: 'dimension';
employeeID .aggregation.role: 'dimension';
projectID .aggregation.role: 'dimension';
projectTeamID .aggregation.role: 'dimension';
hours .aggregation.role: 'measure';
};
annotate ReportingCenter.Analytics with @(UI: {PresentationVariant: {
$Type : 'UI.PresentationVariantType',
Total : [hours],
GroupBy : [
employeeTeamID,
employeeID,
projectID
],
Visualizations: ['@UI.LineItem']
}});
EDIT: I have also tried with the following annotations. They work fine with OData V4 using $apply query but my service is V2 since SAPUI5 smart controls are only supported for OData V2.
using ReportingCenter from '../../../../srv/cds-models/analytics';
using from './line-item';
annotate ReportingCenter.Analytics with @(sap.semantics: 'aggregate');
annotate ReportingCenter.Analytics with {
employeeTeamID @Pa_Vi.aggregation.role: 'dimension' @analytics.Dimension;
employeeID @Pa_Vi.aggregation.role: 'dimension' @analytics.Dimension;
projectID @Pa_Vi.aggregation.role: 'dimension' @analytics.Dimension;
projectTeamID @Pa_Vi.aggregation.role: 'dimension' @analytics.Dimension;
hours @Pa_Vi.aggregation.role: 'measure' @analytics.Measure;
};
annotate ReportingCenter.Analytics with @(UI: {PresentationVariant: {
$Type : 'UI.PresentationVariantType',
Total : [hours],
GroupBy : [
employeeTeamID,
employeeID
],
Visualizations: ['@UI.LineItem']
}});
annotate ReportingCenter.Analytics with @(Aggregation: {ApplySupported: {
$Type : 'Aggregation.ApplySupportedType',
Transformations : [
'aggregate',
'identity',
'groupby',
'filter',
'search'
],
GroupableProperties : [
employeeTeamID,
employeeID,
projectID,
projectTeamID
],
AggregatableProperties: [{
$Type : 'Aggregation.AggregatablePropertyType',
Property: hours
}]
}});
annotate ReportingCenter.Analytics with @(Analytics.AggregatedProperty #sumHours: {
$Type : 'Analytics.AggregatedPropertyType',
Name : 'sumHours',
AggregationMethod : 'sum',
AggregatableProperty: hours
});Request clarification before answering.
| User | Count |
|---|---|
| 12 | |
| 9 | |
| 7 | |
| 5 | |
| 4 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.