Skip to Content
0

SAP FIORI OVP tutorial with CDS - DATAPOINT on CDS not working

Jun 06, 2017 at 04:21 PM

274

avatar image

Hi All,

I have followed the steps in the blog at the below link:

https://blogs.sap.com/2016/07/05/creating-a-fiori-ovp-application-with-cds-view-annotations-part-2/

Its working fine without datapoints.

But I am not able to setup the datapoint.

Below is how the annotations are used

@UI.lineItem:  { type: #AS_DATAPOINT, position: 30, qualifier:'ordOverView', label: 'Net Amount' }
@UI.dataPoint:{title: 'NetAmount', targetValueElement: 'net_amount',targetValue: 1000,
                criticalityCalculation:{ improvementDirection: #TARGET,                                        
                                         deviationRangeLowValue: 100,
                                         toleranceRangeLowValue: 40,
                                         toleranceRangeHighValue: 800,
                                         deviationRangeHighValue: 1200 } 
              }              
so.net_amount,

Getting the following error on the card.

Getting the following error in console.

Any help is appreciated.

Thanks,

Ashiq Ali Ratnani

snap1.jpg (14.0 kB)
snap2.jpg (132.3 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Best Answer
AshiqAli Ratnani Jul 04, 2017 at 07:53 AM
0

Fixed this by creating a local annotation file and referring to that for displaying the cards.

Made the below change in the annotation file.

Annotation file coming from CDS:

<Record Type="UI.DataFieldForAnnotation">
<PropertyValue Property="Label" String="Net Amount"/>
<PropertyValue Property="Value" AnnotationPath="@UI.DataPoint#net_amount"/>
</Record>

Modified location annotation file:

<Record Type="UI.DataFieldForAnnotation">
<PropertyValue Property="Label" String="Net Amount"/>
<PropertyValue Property="Target" AnnotationPath="@UI.DataPoint#net_amount"/>
</Record><br>
Share
10 |10000 characters needed characters left characters exceeded
Jamie Cawley
Jun 07, 2017 at 11:55 AM
0

On the @UI.lineItem try removing "type: #AS_DATAPOINT". I would also remove "targetValueElement: 'net_amount',targetValue: 1000" on the @UI.dataPoint

Regards,

Jamie

Show 3 Share
10 |10000 characters needed characters left characters exceeded

Thanks Jamie.

Earlier i was trying without those values itself.

But then the colors are not showing up based on the criticality values

snap1.jpg (49.6 kB)
0

Try putting the lineItem under the datapoint and then adding the "type: #AS_DATAPOINT" back in. If it causes issues again, compare the annotation file that is downloaded to a working one. You can use the browser dev tools to see it.

Regards,

Jamie

0

Here are the snaps from the annotation files.

Success scenario:

Error scenario:


Below is how datapoint annotation is looking:

(ignore the gross_amount related annotation. That has been removed)


0
Jamie Cawley
Jun 12, 2017 at 09:42 PM
0

On the DataFieldForAnnotation it showing that the property is value, but it should target. Did you add the targetValueElement back in, I think this would be causing the issue.

Regards,

Jamie

Show 4 Share
10 |10000 characters needed characters left characters exceeded

Nops did not add it.

Can you tell me how to get the annotation file while running the application? I got the above screen shots when create a project using the template.

Thanks for comments.

0

You should see it in the browser dev tools under the network tab. You can filter by "annotations" to find it.

Regards,

Jamie

1

Thanks.

Do you see any other reason as to why the property is coming as "Value" instead of "Target"

0

I do not. Maybe try setting up a new CDS view exactly how it is done in the blog and see if the error still exists.

Regards,

Jamie

0
AshiqAli Ratnani Jun 14, 2017 at 06:21 AM
0

Still don't have a solution for this. Any other inputs or help?

Share
10 |10000 characters needed characters left characters exceeded