cancel
Showing results for 
Search instead for 
Did you mean: 

Problem chart Analytical List Page when aggregation-roles added to the medata

RenaatHaleydt
Explorer
0 Kudos

Hello SAP-Community!

My experience in annotations and CDS is limited, so I hope you guys can help me out!

My problem lies in the chart of the ALP when I add some aggregation-roles to the metadata for displaying a Visual Filter.

I have a working chart and table with a common filter as you can see here.

When I add aggregation-roles in the metadata to display the Visual Filter, my filter is working (hooray!) but my chart displays only the last entity in the list as you can see.

Now you know my problem, let me explain the set-up.

I have an OData service thanks to the n-odata-server module in Node.js, this converts JSON into OData.

But no worries: I am able to add attributes to the metadata-file. And there lies my problem, I guess.

My metadata looks like this when the chart is working:

<?xml version="1.0" encoding="UTF-8"?>
<edmx:Edmx xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:sap="http://www.sap.com/Protocols/SAPData" Version="1.0">
    <edmx:Reference xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Uri="./IWFND/CATALOGSERVICE;v=2/Vocabularies(TechnicalName='%2FIWBEP%2FVOC_AGGREGATION',Version='0001',SAP__Origin='LOCAL')/$value">
        <edmx:Include Namespace="Org.OData.Aggregation.V1" Alias="Aggregation"/>
    </edmx:Reference>
    <edmx:DataServices m:DataServiceVersion="2.0">
        <Schema xmlns="http://schemas.microsoft.com/ado/2008/09/edm" Namespace="NODATASERVER" xml:lang="en" sap:schema-version="1">
            <EntityType Name="ResourceType">
                <Key>
                    <PropertyRef Name="id"/>
                </Key>
                <Property Name="id" Type="Edm.Int32"/>
                <Property Name="description" Type="Edm.String"/>
                <Property Name="billingOverview" Type="Edm.Boolean"/>
                <NavigationProperty Name="resources" Relationship="NODATASERVER.Resource_resourceType_ResourceType_resources" FromRole="ResourceType_resources" ToRole="Resource_resourceType"/>
                <NavigationProperty Name="resourcesPerMonth" Relationship="NODATASERVER.Resource_resourceType_ResourceType_resources" FromRole="ResourceType_resources" ToRole="Resource_resourceType"/>
            </EntityType>
            <EntityType Name="ResourcePerMonth">
                <Key>
                    <PropertyRef Name="id"/>
                </Key>
                <Property Name="resourceId" Type="Edm.Decimal"/>
                <Property Name="absenceIncludedBillability" Type="Edm.Decimal"/>
                <Property Name="absentDays" Type="Edm.Decimal"/>
                <Property Name="absentDaysPercentage" Type="Edm.Decimal"/>
                <Property Name="company" Type="Edm.String"/>
                <Property Name="customerRelatedDays" Type="Edm.Decimal"/>
                <Property Name="customerRelatedDaysPercentage" Type="Edm.Decimal"/>
                <Property Name="firstName" Type="Edm.String"/>
                <Property Name="function" Type="Edm.String"/>
                <Property Name="idleDays" Type="Edm.Decimal"/>
                <Property Name="idleDaysPercentage" Type="Edm.Decimal"/>
                <Property Name="internalDays" Type="Edm.Decimal"/>
                <Property Name="internalDaysPercentage" Type="Edm.Decimal"/>
                <Property Name="joiningDate" Type="Edm.String"/>
                <Property Name="lastName" Type="Edm.String"/>
                <Property Name="leavingDate" Type="Edm.String"/>
                <Property Name="level" Type="Edm.String"/>
                <Property Name="timeSheetAccuracy" Type="Edm.Decimal"/>
                <Property Name="timeSheetConfirmationAccuracy" Type="Edm.Decimal"/>
                <Property Name="totalAvailableDays" Type="Edm.Decimal"/>
                <Property Name="timesheetConfirmationAccuracyCritical" Type="Edm.Decimal"/>
                <Property Name="TACI" Type="Edm.Decimal"/>
                <Property Name="TACE" Type="Edm.Decimal"/>
                <Property Name="billabilityAnalysisDate" Type="Edm.DateTime" sap:display-format="Date"/>
                <Property Name="firstDayOfMonth" Type="Edm.DateTime" sap:display-format="Date"/>
                <Property Name="id" Type="Edm.Int32"/>
                <Property Name="resourceTypeId" Type="Edm.Decimal"/>
                <NavigationProperty Name="resourceType" Relationship="NODATASERVER.Resource_resourceType_ResourceType_resources" FromRole="ResourceType_resources" ToRole="ResourceType_resources"/>
            </EntityType>
            <EntityContainer Name="NODATASERVER" m:IsDefaultEntityContainer="true">
                <EntitySet Name="ResourceTypes" EntityType="NODATASERVER.ResourceType"/>
                <EntitySet Name="ResourcesPerMonth" EntityType="NODATASERVER.ResourcePerMonth"/>
            </EntityContainer>
        </Schema>
    </edmx:DataServices>
</edmx:Edmx>

When I add the aggregation-roles, my metadata is formed like this

<?xml version="1.0" encoding="UTF-8"?>
<edmx:Edmx xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:sap="http://www.sap.com/Protocols/SAPData" Version="1.0">
    <edmx:Reference xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Uri="./IWFND/CATALOGSERVICE;v=2/Vocabularies(TechnicalName='%2FIWBEP%2FVOC_COMMON',Version='0001',SAP__Origin='LOCAL')/$value">
        <edmx:Include Namespace="Org.OData.Common.v1" Alias="Common"/>
    </edmx:Reference>
    <edmx:DataServices m:DataServiceVersion="2.0">
        <Schema xmlns="http://schemas.microsoft.com/ado/2008/09/edm" Namespace="NODATASERVER">
            <EntityType Name="ResourceType">
                <Key>
                    <PropertyRef Name="id"/>
                </Key>
                <Property Name="id" Type="Edm.Int32"/>
                <Property Name="description" Type="Edm.String"/>
                <Property Name="billingOverview" Type="Edm.Boolean"/>
                <NavigationProperty Name="resources" Relationship="NODATASERVER.Resource_resourceType_ResourceType_resources" FromRole="ResourceType_resources" ToRole="Resource_resourceType"/>
                <NavigationProperty Name="resourcesPerMonth" Relationship="NODATASERVER.Resource_resourceType_ResourceType_resources" FromRole="ResourceType_resources" ToRole="Resource_resourceType"/>
            </EntityType>
            <EntityType Name="ResourcePerMonth" sap:semantics="aggregate">
                <Key>
                    <PropertyRef Name="id"/>
                </Key>
                <Property Name="resourceId" Type="Edm.Decimal"/>
                <Property Name="absenceIncludedBillability" Type="Edm.Decimal" sap:aggregation-role="measure"/>
                <Property Name="absentDays" Type="Edm.Decimal" sap:aggregation-role="measure"/>
                <Property Name="absentDaysPercentage" Type="Edm.Decimal" sap:aggregation-role="measure"/>
                <Property Name="company" Type="Edm.String" sap:aggregation-role="measure"/>
                <Property Name="customerRelatedDays" Type="Edm.Decimal" sap:aggregation-role="measure"/>
                <Property Name="customerRelatedDaysPercentage" Type="Edm.Decimal" sap:aggregation-role="measure"/>
                <Property Name="firstName" Type="Edm.String" sap:aggregation-role="dimension"/>
                <Property Name="function" Type="Edm.String" sap:aggregation-role="dimension"/>
                <Property Name="idleDays" Type="Edm.Decimal" sap:aggregation-role="measure"/>
                <Property Name="idleDaysPercentage" Type="Edm.Decimal" sap:aggregation-role="measure"/>
                <Property Name="internalDays" Type="Edm.Decimal" sap:aggregation-role="measure"/>
                <Property Name="internalDaysPercentage" Type="Edm.Decimal" sap:aggregation-role="measure"/>
                <Property Name="joiningDate" Type="Edm.String"/>
                <Property Name="lastName" Type="Edm.String" sap:aggregation-role="dimension"/>
                <Property Name="leavingDate" Type="Edm.String"/>
                <Property Name="level" Type="Edm.String" sap:aggregation-role="dimension"/>
                <Property Name="timeSheetAccuracy" Type="Edm.Decimal" sap:aggregation-role="measure"/>
                <Property Name="timeSheetConfirmationAccuracy" Type="Edm.Decimal" sap:aggregation-role="measure"/>
                <Property Name="totalAvailableDays" Type="Edm.Decimal" sap:aggregation-role="measure"/>
                <Property Name="timesheetConfirmationAccuracyCritical" Type="Edm.Decimal" sap:aggregation-role="measure"/>
                <Property Name="TACI" Type="Edm.Decimal" sap:aggregation-role="measure"/>
                <Property Name="TACE" Type="Edm.Decimal" sap:aggregation-role="measure"/>
                <Property Name="billabilityAnalysisDate" Type="Edm.DateTime" sap:display-format="Date" sap:aggregation-role="dimension"/>
                <Property Name="firstDayOfMonth" Type="Edm.DateTime" sap:display-format="Date"/>
                <Property Name="id" Type="Edm.Int32"/>
                <Property Name="resourceTypeId" Type="Edm.Decimal"/>
                <NavigationProperty Name="resourceType" Relationship="NODATASERVER.Resource_resourceType_ResourceType_resources" FromRole="ResourceType_resources" ToRole="ResourceType_resources"/>
            </EntityType>
            <EntityContainer Name="NODATASERVER" m:IsDefaultEntityContainer="true">
                <EntitySet Name="ResourceTypes" EntityType="NODATASERVER.ResourceType"/>
                <EntitySet Name="ResourcesPerMonth" EntityType="NODATASERVER.ResourcePerMonth"/>
            </EntityContainer>
        </Schema>
    </edmx:DataServices>
</edmx:Edmx>

My annotation-file stays the same, the only thing that is changing are the aggregation-roles in the metadata.

(Because of the maximum amount of 20000 characters, I've taken screenshots of my annotation-file). They look like this:

I really have no clue why my chart is displaying only one entity.

Can someone please help me out?

Thanks in advance!

Kind regards

Renaat

Accepted Solutions (0)

Answers (1)

Answers (1)

RenaatHaleydt
Explorer
0 Kudos

Hello all,

I found the answer to my problem. Because of automatic ID-injection in the backend, there was no aggregation bound to it. So I placed a "sap:aggregtion-role:dimension" on it and now it works.

Thanks anyway!

Kind regards,

Renaat