2024 Dec 09 12:22 AM - edited 2024 Dec 09 12:28 AM
Hello community,
after many hours of try and fail, asking the community experts here.
I'm trying to create an SAP Fiori Elements - Overview Page.
In the backend I've written the RAP Odata V2 service (almost no CDS annotations as I mainly use XML annotations via Guided Implementation wizard).
The CDS structure is following (synthetic example):
Date (abap.dats) | Price_Germany (int4) | Price_USA (int4) |
01 December 2024 | 100 | 200 |
02 December 2024 | 101 | 202 |
03 December 2024 | 105 | 210 |
In the Overview Page I've created several cards, including the Line Chart. All good.
The line is displayed properly for Price_Germany.
Now I would like to add another line to the same Line Chart, so I have Price_USA displayed.
Can you please let me know how this can be achieved?
I tried following:
<Annotation Term="UI.Chart" Qualifier="ChartQualifier_Prices">
<Record Type="UI.ChartDefinitionType">
<PropertyValue Property="ChartType" EnumMember="UI.ChartType/Line" />
<PropertyValue Property="Title" String="Price Germany vs USA" />
<PropertyValue Property="Dimensions">
<Collection>
<PropertyPath>Date</PropertyPath>
</Collection>
</PropertyValue>
<PropertyValue Property="DimensionAttributes">
<Collection>
<Record Type="UI.ChartDimensionAttributeType">
<PropertyValue Property="Dimension" PropertyPath="Date" />
<PropertyValue Property="Role" EnumMember="UI.ChartDimensionRoleType/Category" />
</Record>
</Collection>
</PropertyValue>
<PropertyValue Property="Measures">
<Collection>
<PropertyPath>Price_Germany</PropertyPath>
<PropertyPath>Price_USA</PropertyPath>
</Collection>
</PropertyValue>
<PropertyValue Property="MeasureAttributes">
<Collection>
<Record>
<PropertyValue Property="Measure" PropertyPath="Price_Germany"/>
<PropertyValue Property="Role" EnumMember="UI.ChartMeasureRoleType/Axis1" />
</Record>
<Record>
<PropertyValue Property="Measure" PropertyPath="Price_USA"/>
<PropertyValue Property="Role" EnumMember="UI.ChartMeasureRoleType/Axis1" />
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
But it is throwing be the error 50017 - incorrect Binding
Feels like I'm somewhere very close, but can't find a solution and it is frustrating 🙂
Please kindly advise.
Request clarification before answering.
Ok, found a solution on my own.
What was missing is the Aggregation in CDS view, that will add the metadata properties automatically.
@Aggregation.default: #SUM
Price_Germany,
@Aggregation.default: #SUM
Price_USA
Metadata gets:
<Property Name="SnapshotDate" Type="Edm.DateTime" Precision="0" sap:display-format="Date" sap:label="Date" sap:quickinfo="Snapshot Date"/>
<Property Name="Price_Germany" Type="Edm.Int32" sap:label="Amount" sap:quickinfo="Info"/>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
64 | |
8 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.