To create a table card, you need these annotations:
(Optional) You can configure smart links in table cards to access quick links.
The com.sap.vocabularies.UI.v1.LineItem
term can be configured in
the application manifest file by setting the annotationPath
property with a qualifier, as shown in the example below. If the
annotationPath
property is not configured, the
com.sap.vocabularies.UI.v1.LineItem
term, without a qualifier,
is used.
"sap.ovp": { ... "disableTableCardFlexibility": false, ... "card02": { "model": "salesOrder", "template": "sap.ovp.cards.table", "settings": { "title": "Sales Orders With Analytical Header", "subTitle": "Sales Orders With Analytical Header", "listFlavor": "bar", "listType": "extended", "entitySet": "SalesOrderSet", "dataPointAnnotationPath": "com.sap.vocabularies.UI.v1.DataPoint#line_without_trend", "selectionAnnotationPath": "com.sap.vocabularies.UI.v1.SelectionVariant#line1", "annotationPath": "com.sap.vocabularies.UI.v1.LineItem#View1", "presentationAnnotationPath": "com.sap.vocabularies.UI.v1.PresentationVariant#line" } }, ... } }
In SAP Fiori elements for OData V4, add
sap.ovp.cards.v4.table
as the template
.
All other manifest settings are the same as in SAP
Fiori elements for OData V2.
You can use different com.sap.vocabularies.UI.v1.LineItem
annotations for different card instances of the same entity type by using different
qualifiers and setting the annotationPath
property with the
qualifier in the card configuration. For example
com.sap.vocabularies.UI.v1.LineItem#Qualifier1
.
If you set "disableTableCardFlexibility": true
, then at runtime,
DataField
records are sorted according to importance set in the
com.sap.vocabularies.UI.v1.ImportanceType
annotation, and their
order of entry. The first two DataField
records are displayed in
the first two columns of the table. If there is a
DataFieldForAnnotation
record that has a
DataPoint
target, it is used for the third column and its value
is highlighted according to the criticality of the DataPoint
. If no
DataFieldForAnnotation
is defined, the next
DataField
record is displayed in the third column.
If you set "disableTableCardFlexibility": false
, then at runtime,
table columns are sorted according to the importance set in the
com.sap.vocabularies.UI.v1.ImportanceType
annotation, and their
order of entry.
If a DataField
record points to a path that exists in a
DataPoint
target, it is skipped so that the property is not
displayed more than once in the same table.
In this example, the first column in the table displays
Product Name, the second column displays
Supplier, and the third column displays Weight
Measure (according to the DataPoint
target).
XML Annotation
<Annotation Term="com.sap.vocabularies.UI.v1.DataPoint" Qualifier="WeightMeasure"> <Record Type="com.sap.vocabularies.UI.v1.DataPointType"> <PropertyValue Property="Title" String="Weight"/> <PropertyValue Property="Description" Path="Name"/> <PropertyValue Property="Value" Path="WeightMeasure"/> <PropertyValue Property="CriticalityCalculation"> <Record Type="com.sap.vocabularies.UI.v1.CriticalityCalculationType"> <PropertyValue Property="ImprovementDirection" EnumMember="com.sap.vocabularies.UI.v1.CriticalityCalculationType/Maximize"/> <PropertyValue Property="ToleranceRangeLowValue" Int="2"/> <PropertyValue Property="DeviationRangeLowValue" Int="4"/> </Record> </PropertyValue> </Record> </Annotation> <Annotation Term="com.sap.vocabularies.UI.v1.LineItem"> <Collection> <Record Type="com.sap.vocabularies.UI.v1.DataField"> <PropertyValue Property="Label" String="Product ID"/> <PropertyValue Property="Value" Path="ProductID"/> </Record> <Record Type="com.sap.vocabularies.UI.v1.DataField"> <PropertyValue Property="Label" String="Category"/> <PropertyValue Property="Value" Path="Category"/> </Record> <Record Type="com.sap.vocabularies.UI.v1.DataField"> <PropertyValue Property="Label" String="Product Name"/> <PropertyValue Property="Value" Path="Name"/> <Annotation Term="com.sap.vocabularies.UI.v1.Importance" EnumMember="com.sap.vocabularies.UI.v1.ImportanceType/High"/> </Record> <Record Type="com.sap.vocabularies.UI.v1.DataField"> <PropertyValue Property="Label" String="Supplier"/> <PropertyValue Property="Value" Path="SupplierName"/> <Annotation Term="com.sap.vocabularies.UI.v1.Importance" EnumMember="com.sap.vocabularies.UI.v1.ImportanceType/High"/> </Record> <Record Type="com.sap.vocabularies.UI.v1.DataField"> <PropertyValue Property="Label" String="Unit Price"/> <PropertyValue Property="Value" Path="Price"/> <Annotation Term="com.sap.vocabularies.UI.v1.Importance" EnumMember="com.sap.vocabularies.UI.v1.ImportanceType/High"/> </Record> <Record Type="com.sap.vocabularies.UI.v1.DataFieldForAnnotation"> <PropertyValue Property="Label" String="Weight Measure"/> <PropertyValue Property="Target" AnnotationPath="@com.sap.vocabularies.UI.v1.DataPoint#WeightMeasure"/> </Record> </Collection> </Annotation>
ABAP CDS Annotation
@UI.dataPoint: { title: 'Weight', description: 'Name', valueFormat: { scaleFactor: 2, numberOfFractionalDigits: 1 }, criticalityCalculation: { improvementDirection: #MAXIMIZE, deviationRangeHighValue: 4.3, toleranceRangeHighValue: 2.5 } WeightMeasure; @UI.lineItem: [ { label: 'Product ID', position: 10 } ] PRODUCTID; @UI.lineItem: [ { label: 'Category', position: 20 } ] CATEGORY; @UI.lineItem: [ { importance: #HIGH, label: 'Product Name', position: 30 } ] NAME; @UI.lineItem: [ { importance: #HIGH, label: 'Supplier', position: 40 } ] SUPPLIERNAME; @UI.lineItem: [ { importance: #HIGH, label: 'Unit Price', position: 50 } ] PRICE; @UI.lineItem: [ { label: 'Weight Measure', valueQualifier: 'WeightMeasure', type: #AS_DATAPOINT, position: 60 } ] PROPERTY_NAME;
CAP CDS Annotation
UI.DataPoint #WeightMeasure : { $Type : 'UI.DataPointType', Title : 'Weight', Description : Name, Value : WeightMeasure, CriticalityCalculation : { $Type : 'UI.CriticalityCalculationType', ImprovementDirection : #Maximize, ToleranceRangeLowValue : 2.5, DeviationRangeLowValue : 4.3 } }, UI.LineItem : [ { $Type : 'UI.DataField', Label : 'Product ID', Value : ProductID }, { $Type : 'UI.DataField', Label : 'Category', Value : Category }, { $Type : 'UI.DataField', Label : 'Product Name', Value : Name, ![@UI.Importance] : #High }, { $Type : 'UI.DataField', Label : 'Supplier', Value : SupplierName, ![@UI.Importance] : #High }, { $Type : 'UI.DataField', Label : 'Unit Price', Value : Price, ![@UI.Importance] : #High }, { $Type : 'UI.DataFieldForAnnotation', Label : 'Weight Measure', Target : '@UI.DataPoint#WeightMeasure' } ]
Define a semantic object for the entity set and its property using the annotation target to enable smart links in a table card. For example:
XML Annotation
<Annotations Target="GWSAMPLE_BASIC.SalesOrder/SalesOrderID"> <Annotation Term="com.sap.vocabularies.Common.v1.SemanticObject" String="OVP" /> </Annotations>
ABAP CDS Annotation
annotate view SALESORDER with { @Consumption.semanticObject: 'OVP' salesorderid; }
CAP CDS Annotation
annotate GWSAMPLE_BASIC.SalesOrder with { @Common.SemanticObject : 'OVP' SalesOrderID };
Table cards also let you view contact information if you have defined
the com.sap.vocabularies.Communication.v1.Contact
annotation.
XML Annotation
<Annotation Term="com.sap.vocabularies.UI.v1.LineItem" Qualifier="NewSalesOrders"> <Collection> <Record Type="com.sap.vocabularies.UI.v1.DataField"> <PropertyValue Property="Label" String="Order ID (Company)"/> <PropertyValue Property="Value" Path="SalesOrderID"/> </Record> <Record Type="com.sap.vocabularies.UI.v1.DataFieldForAnnotation"> <PropertyValue Property="Label" String="Created by (Role)" /> <PropertyValue Property="Target" AnnotationPath="ToBusinessPartner/@com.sap.vocabularies.Communication.v1.Contact" /> </Record> </Collection> </Annotation>
ABAP CDS Annotation
@UI.lineItem: [ { label: 'Order ID (Company)', position: 10, qualifier: 'NewSalesOrders' } ] SALESORDERID; @UI.lineItem: [ { label: 'Created by (Role)', value: '_BUSINESSPARTNER', type: #AS_CONTACT, position: 20 , qualifier: 'NewSalesOrders' } ] PROPERT_NAME;
CAP CDS Annotation
UI.LineItem #NewSalesOrders : [ { $Type : 'UI.DataField', Label : 'Order ID (Company)', Value : SalesOrderID }, { $Type : 'UI.DataFieldForAnnotation', Label : 'Created by (Role)', Target : 'ToBusinessPartner/@Communication.Contact' } ]
XML Annotation
<Annotation Term="com.sap.vocabularies.Communication.v1.Contact"> <Record> <PropertyValue Property="tel"> <Collection> <Record> <PropertyValue Property="type" EnumMember="com.sap.vocabularies.Communication.v1.PhoneType/fax" /> <PropertyValue Property="uri" Path="FaxNumber" /> </Record> <Record> <PropertyValue Property="type" EnumMember="com.sap.vocabularies.Communication.v1.PhoneType/work com.sap.vocabularies.Communication.v1.PhoneType/preferred" /> <PropertyValue Property="uri" Path="PhoneNumber" /> </Record> </Collection> </PropertyValue> <PropertyValue Property="email"> <Collection> <Record> <PropertyValue Property="type" EnumMember="com.sap.vocabularies.Communication.v1.ContactInformationType/preferred com.sap.vocabularies.Communication.v1.ContactInformationType/work" /> <PropertyValue Property="address" Path="EmailAddress" /> </Record> </Collection> </PropertyValue> </Record> </Annotation>
ABAP CDS Annotation
define view VIEWNAME { @Semantics.name.fullName: true CompanyName, @Semantics.eMail.address: true @Semantics.eMail.type: [#WORK] EmailAddress, @Semantics.telephone.type: [ #FAX ] FaxNumber, @Semantics.telephone.type: [ #WORK] PhoneNumber }
CAP CDS Annotation
Communication.Contact : { tel : [ { type : #fax, uri : FaxNumber }, { type : [ #work, #pref ], uri : PhoneNumber }, ], email : [ { type : [ #pref, #work ], address : EmailAddress } ] }
The text arrangement annotation lets you to format of text.
XML Annotation
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="GWSAMPLE_BASIC.SalesOrder/CustomerID"> <Annotation Term="com.sap.vocabularies.Common.v1.Text" Path="Supplier_Name"> <Annotation Term="com.sap.vocabularies.UI.v1.TextArrangement" EnumMember="com.sap.vocabularies.UI.v1.TextArrangementType/TextLast" /> </Annotation> </Annotations>
ABAP CDS Annotation
annotate view SALESORDER with { @UI.TextArrangement: #TEXT_LAST customerid; }
CAP CDS Annotation
annotate GWSAMPLE_BASIC.SalesOrder with { @Common.Text : Supplier_Name @UI.TextArrangement : #TextLast CustomerID };
In the preceding example, the text Customer
is bound to
the ContactID
property and appears as shown in the table:
Text Arrangement Type |
Result |
---|---|
|
ContractID (Customer) |
|
Customer (ContractID) |
|
Customer |
The DataPoint or DataField is aligned as shown in the table below:
Annotation Field |
Table Alignment |
---|---|
DataField, Contact annotation |
Left Aligned |
DataPoint with or without Criticality/CriticalityCalculation OR property (either DataField or DataPoint) of type Edm.DateTime or Edm.DateTimeOffset |
Right Aligned |
DataPoint with Criticality and property of type Edm.String |
Center Aligned |