a month ago
Main goal: Annotate an EntityType's property with multiple semantic objects.
On the website: Demo Kit - SAPUI5 SDK, in API reference, there is something called Smart Links which allow you to annotate a single property with multiple semantic objects. If you go to Samples and search for it, you can find an example for "Smart Link with field annotated to multiple SemanticObjects", and by clicking on the "Show Source Code" button, it seems like the view.xml file is implemented as:
<SmartLink text="{Name}" semanticObject="dummy" additionalSemanticObjects="demokit_smartlink_example_09_SemanticObjectNameAdditional,demokit_smartlink_example_09_SemanticObjectNameAdditional2" enableAvailableActionsPersonalization="false"/>
and there is a controller.js:
sap.ui.define([ 'sap/ui/core/mvc/Controller', 'sap/ui/comp/navpopover/SemanticObjectController' ],
function(Controller, SemanticObjectController) {
"use strict";
return Controller.extend("sap.ui.comp.sample.smartlink.example_09.Example", { onInit: function() {
SemanticObjectController.destroyDistinctSemanticObjects();
this.getView().bindElement("/ProductCollection('1239102')");
}
});
});
However in my own Fiori project which I've created from "SAP Fiori Generator" in SAP Business Application Studio, I do not have such a views.xml file, nor anything that resembles it. I am mainly using an annotations.xml file, which implements a table using:
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SAP.ZZ1_C_SLCNTRINFOQRYType/SalesDocument">
<Annotation Term="com.sap.vocabularies.Common.v1.SemanticObject" String="SalesContract"/>
</Annotations>
<Annotations Target="SAP.ZZ1_C_SLCNTRINFOQRYType">
<Annotation Term="UI.LineItem" Qualifier="tab0">
<Collection>
<Record Type="UI.DataField">
<PropertyValue Property="Label" String="Sales Document"/>
<PropertyValue Property="Value" Path="SalesDocument"/>
</Record>
...
</Collection>
</Annotation>
...
</Annotations>
In this case, the first Annotations element populates all references to the SalesDocument property with navigation to the apps that have the semantic object SalesContract. However I want to add a second semantic object for app navigation, "AccountingDocument", which I do not believe is possible with this annotation. Could someone please explain how I could adapt the sample Smart Link example to my case, or suggest an alternative?
Thank you for the help!
Request clarification before answering.
ok in that case( add the smartLink to all elements in the column "Sales Document" of table), the association Consumption.semanticObject comes to the rescue. link
In your CDS view for table, enhance it with the @Consumption.semanticObject annotation.
for example:-
@AbapCatalog.sqlViewName: 'ZSALES_DOC'
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Sales Document List'
define view entity ZC_SalesDocument as select from ZI_SalesDocument {
@ui.lineItem: [{ position: 10, type: #STANDARD }]
@ui.identification: [{ position: 10 }]
@Consumption.semanticObject: 'SalesDocument' // Enables SmartLink
key SalesDocument as SalesDocument,
@ui.lineItem: [{ position: 20 }]
Customer,
@ui.lineItem: [{ position: 30 }]
NetAmount
}
Thanks,
Arun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
9 | |
8 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.