cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Fiori Overview Page: 2 lines in 1 chart

RiabovAleksandr
Product and Topic Expert
Product and Topic Expert
225

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 2024100200
02 December 2024101202
03 December 2024105210

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. 

View Entire Topic
RiabovAleksandr
Product and Topic Expert
Product and Topic Expert

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"/>