SAP Fiori Elements Navigation Links Not Generated - sapui5

I'm developing an application using SAP's Fiori Elements and an oData V4 service. The application is a standard List Report and Object Page. I've made several of these applications before, and always the link between the List Report and the Object page is automatically generated. However, in this case only the link is not generated. When I click a row on the List Report Page, no navigation to the Object Page is generated. I don't understand what I'm doing wrong. I suspect the issue could be related to the oData service itself, but I can't find any information about where in an oData service a Fiori Elements page might derive this link. Any advice would be appreciated.
Here is an image of the screen output:
screen ouput
Below is the relevant parts of my manifest:
{
"_version": "1.8.0",
"sap.app": {
"id": "sales",
"type": "application",
"title": "{{appTitle}}",
"description": "{{appDescription}}",
"dataSources": {
"ProjectService": {
"uri": "/api/project/",
"type": "OData",
"settings": {
"odataVersion": "4.0"
}
}
},
"-sourceTemplate": {
"id": "ui5template.basicSAPUI5ApplicationProject",
"-id": "ui5template.smartTemplate",
"-version": "1.40.12"
}
},
"sap.ui5": {
"dependencies": {
"libs": {
"sap.fe.templates": {}
}
},
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"uri": "i18n/i18n.properties"
},
"": {
"dataSource": "ProjectService",
"settings": {
"synchronizationMode": "None",
"operationMode": "Server",
"autoExpandSelect": true,
"earlyRequests": true,
"groupProperties": {
"default": {
"submit": "Auto"
}
}
}
}
},
"routing": {
"routes": [
{
"pattern": ":?query:",
"name": "SalesList",
"target": "SalesList"
},
{
"pattern": "SalesOrders({key}):?query:",
"name": "SalesDetails",
"target": "SalesDetails"
}
],
"targets": {
"SalesList": {
"type": "Component",
"id": "SalesList",
"name": "sap.fe.templates.ListReport",
"options": {
"settings": {
"entitySet": "SalesOrders",
"navigation": {
"SalesOrders": {
"detail": {
"route": "SalesDetails"
}
}
}
}
}
},
"SalesDetails": {
"type": "Component",
"id": "SalesDetails",
"name": "sap.fe.templates.ObjectPage",
"options": {
"settings": {
"entitySet": "SalesOrders"
}
}
}
}
},
"contentDensities": {
"compact": true,
"cozy": true
}
},
"sap.ui": {
"technology": "UI5",
"fullWidth": false
},
"sap.fiori": {
"registrationIds": [],
"archeType": "transactional"
}
}
EDIT:
Below is the metadata document for the service I used to generate the application.
<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0">
<edmx:Reference Uri="https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Capabilities.V1.xml">
<edmx:Include Namespace="Org.OData.Capabilities.V1" Alias="Capabilities"/>
</edmx:Reference>
<edmx:Reference Uri="https://sap.github.io/odata-vocabularies/vocabularies/Common.xml">
<edmx:Include Namespace="com.sap.vocabularies.Common.v1" Alias="Common"/>
</edmx:Reference>
<edmx:Reference Uri="https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Core.V1.xml">
<edmx:Include Namespace="Org.OData.Core.V1" Alias="Core"/>
</edmx:Reference>
<edmx:Reference Uri="https://sap.github.io/odata-vocabularies/vocabularies/UI.xml">
<edmx:Include Namespace="com.sap.vocabularies.UI.v1" Alias="UI"/>
</edmx:Reference>
<edmx:DataServices>
<Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="project">
<EntityType Name="Currencies">
<Key>
<PropertyRef Name="code"/>
</Key>
<Property Name="name" Type="Edm.String" MaxLength="255"/>
<Property Name="descr" Type="Edm.String" MaxLength="1000"/>
<Property Name="code" Type="Edm.String" Nullable="false" MaxLength="3"/>
<Property Name="symbol" Type="Edm.String" MaxLength="5"/>
<NavigationProperty Name="texts" Type="Collection(project.Currencies_texts)">
<OnDelete Action="Cascade"/>
</NavigationProperty>
<NavigationProperty Name="localized" Type="project.Currencies_texts">
<ReferentialConstraint Property="code" ReferencedProperty="code"/>
</NavigationProperty>
</EntityType>
<EntityType Name="Currencies_texts">
<Key>
<PropertyRef Name="locale"/>
<PropertyRef Name="code"/>
</Key>
<Property Name="locale" Type="Edm.String" Nullable="false" MaxLength="14"/>
<Property Name="name" Type="Edm.String" MaxLength="255"/>
<Property Name="descr" Type="Edm.String" MaxLength="1000"/>
<Property Name="code" Type="Edm.String" Nullable="false" MaxLength="3"/>
</EntityType>
<EntityType Name="POrders">
<Key>
<PropertyRef Name="ID"/>
</Key>
<Property Name="ID" Type="Edm.Guid" Nullable="false"/>
<Property Name="createdAt" Type="Edm.DateTimeOffset" Precision="7"/>
<Property Name="createdBy" Type="Edm.String" MaxLength="255"/>
<Property Name="modifiedAt" Type="Edm.DateTimeOffset" Precision="7"/>
<Property Name="modifiedBy" Type="Edm.String" MaxLength="255"/>
<Property Name="OrderNo" Type="Edm.String"/>
<Property Name="total" Type="Edm.Decimal" Precision="9" Scale="2"/>
<Property Name="currency_code" Type="Edm.String" MaxLength="3"/>
<NavigationProperty Name="currency" Type="project.Currencies">
<ReferentialConstraint Property="currency_code" ReferencedProperty="code"/>
</NavigationProperty>
</EntityType>
<EntityType Name="PurchaseOrderItems">
<Key>
<PropertyRef Name="EBELN"/>
<PropertyRef Name="EBELP"/>
</Key>
<Property Name="EBELN" Type="Edm.String" Nullable="false" MaxLength="10"/>
<Property Name="EBELP" Type="Edm.String" Nullable="false" MaxLength="5"/>
<Property Name="MATNR" Type="Edm.String" MaxLength="40"/>
<Property Name="WERKS" Type="Edm.String" MaxLength="4"/>
</EntityType>
<EntityType Name="PurchaseOrders">
<Key>
<PropertyRef Name="EBELN"/>
</Key>
<Property Name="EBELN" Type="Edm.String" Nullable="false" MaxLength="10"/>
<Property Name="BUKRS" Type="Edm.String" MaxLength="4"/>
<Property Name="BEDAT" Type="Edm.Date"/>
<Property Name="STATU" Type="Edm.String" MaxLength="1"/>
<NavigationProperty Name="Items" Type="Collection(project.PurchaseOrderItems)">
<OnDelete Action="Cascade"/>
</NavigationProperty>
</EntityType>
<EntityType Name="SalesOrderItems">
<Key>
<PropertyRef Name="POSNR"/>
<PropertyRef Name="VBELN"/>
</Key>
<Property Name="POSNR" Type="Edm.String" Nullable="false" MaxLength="6"/>
<Property Name="VBELN" Type="Edm.String" Nullable="false" MaxLength="10"/>
<Property Name="MATNR" Type="Edm.String" MaxLength="40"/>
<Property Name="MEINS" Type="Edm.String" MaxLength="3"/>
<Property Name="ZMENG" Type="Edm.String" MaxLength="20"/>
<Property Name="NETPR" Type="Edm.String" MaxLength="20"/>
<Property Name="WAERK" Type="Edm.String" MaxLength="5"/>
</EntityType>
<EntityType Name="SalesOrders">
<Key>
<PropertyRef Name="VBELN"/>
</Key>
<Property Name="VBELN" Type="Edm.String" Nullable="false" MaxLength="10"/>
<Property Name="AUDAT" Type="Edm.Date"/>
<Property Name="AUART" Type="Edm.String" MaxLength="4"/>
<Property Name="KUNNR" Type="Edm.String" MaxLength="10"/>
<NavigationProperty Name="Items" Type="Collection(project.SalesOrderItems)">
<OnDelete Action="Cascade"/>
</NavigationProperty>
</EntityType>
<EntityContainer Name="EntityContainer">
<EntitySet Name="Currencies" EntityType="project.Currencies">
<NavigationPropertyBinding Path="texts" Target="Currencies_texts"/>
<NavigationPropertyBinding Path="localized" Target="Currencies_texts"/>
</EntitySet>
<EntitySet Name="Currencies_texts" EntityType="project.Currencies_texts"/>
<EntitySet Name="POrders" EntityType="project.POrders">
<NavigationPropertyBinding Path="currency" Target="Currencies"/>
</EntitySet>
<EntitySet Name="PurchaseOrderItems" EntityType="project.PurchaseOrderItems"/>
<EntitySet Name="PurchaseOrders" EntityType="project.PurchaseOrders">
<NavigationPropertyBinding Path="Items" Target="PurchaseOrderItems"/>
</EntitySet>
<EntitySet Name="SalesOrderItems" EntityType="project.SalesOrderItems"/>
<EntitySet Name="SalesOrders" EntityType="project.SalesOrders">
<NavigationPropertyBinding Path="Items" Target="SalesOrderItems"/>
</EntitySet>
</EntityContainer>
<Annotations Target="project.Currencies">
<Annotation Term="UI.Identification">
<Collection>
<Record Type="UI.DataField">
<PropertyValue Property="Value">
<Path>name</Path>
</PropertyValue>
</Record>
</Collection>
</Annotation>
</Annotations>
<Annotations Target="project.Currencies/name">
<Annotation Term="Common.Label">
<String>Name</String>
</Annotation>
</Annotations>
<Annotations Target="project.Currencies/descr">
<Annotation Term="Common.Label">
<String>Description</String>
</Annotation>
</Annotations>
<Annotations Target="project.Currencies/code">
<Annotation Term="Common.Label">
<String>Currency Code</String>
</Annotation>
<Annotation Term="Common.Text">
<Path>name</Path>
</Annotation>
</Annotations>
<Annotations Target="project.Currencies/symbol">
<Annotation Term="Common.Label">
<String>Currency Symbol</String>
</Annotation>
</Annotations>
<Annotations Target="project.Currencies_texts/name">
<Annotation Term="Common.Label">
<String>Name</String>
</Annotation>
</Annotations>
<Annotations Target="project.Currencies_texts/descr">
<Annotation Term="Common.Label">
<String>Description</String>
</Annotation>
</Annotations>
<Annotations Target="project.Currencies_texts/code">
<Annotation Term="Common.Label">
<String>Currency Code</String>
</Annotation>
<Annotation Term="Common.Text">
<Path>name</Path>
</Annotation>
</Annotations>
<Annotations Target="project.POrders/ID">
<Annotation Term="Core.Computed">
<Bool>true</Bool>
</Annotation>
</Annotations>
<Annotations Target="project.POrders/createdAt">
<Annotation Term="Common.Label">
<String>Created On</String>
</Annotation>
<Annotation Term="Core.Computed">
<Bool>true</Bool>
</Annotation>
<Annotation Term="Core.Immutable">
<Bool>true</Bool>
</Annotation>
<Annotation Term="UI.HiddenFilter">
<Bool>true</Bool>
</Annotation>
</Annotations>
<Annotations Target="project.POrders/createdBy">
<Annotation Term="Common.Label">
<String>Created By</String>
</Annotation>
<Annotation Term="Core.Computed">
<Bool>true</Bool>
</Annotation>
<Annotation Term="Core.Description">
<String>User's unique ID</String>
</Annotation>
<Annotation Term="Core.Immutable">
<Bool>true</Bool>
</Annotation>
<Annotation Term="UI.HiddenFilter">
<Bool>true</Bool>
</Annotation>
</Annotations>
<Annotations Target="project.POrders/modifiedAt">
<Annotation Term="Common.Label">
<String>Changed On</String>
</Annotation>
<Annotation Term="Core.Computed">
<Bool>true</Bool>
</Annotation>
<Annotation Term="UI.HiddenFilter">
<Bool>true</Bool>
</Annotation>
</Annotations>
<Annotations Target="project.POrders/modifiedBy">
<Annotation Term="Common.Label">
<String>Changed By</String>
</Annotation>
<Annotation Term="Core.Computed">
<Bool>true</Bool>
</Annotation>
<Annotation Term="Core.Description">
<String>User's unique ID</String>
</Annotation>
<Annotation Term="UI.HiddenFilter">
<Bool>true</Bool>
</Annotation>
</Annotations>
<Annotations Target="project.POrders/OrderNo">
<Annotation Term="Common.FieldControl">
<EnumMember>Common.FieldControlType/Mandatory</EnumMember>
</Annotation>
<Annotation Term="Common.Label">
<String>Order Number</String>
</Annotation>
</Annotations>
<Annotations Target="project.POrders/total">
<Annotation Term="Core.Computed">
<Bool>true</Bool>
</Annotation>
</Annotations>
<Annotations Target="project.POrders/currency">
<Annotation Term="Common.Label">
<String>Currency</String>
</Annotation>
<Annotation Term="Core.Description">
<String>Currency code as specified by ISO 4217</String>
</Annotation>
</Annotations>
<Annotations Target="project.POrders/currency_code">
<Annotation Term="Common.Label">
<String>Currency</String>
</Annotation>
<Annotation Term="Common.ValueList">
<Record Type="Common.ValueListType">
<PropertyValue Property="Label">
<String>Currency</String>
</PropertyValue>
<PropertyValue Property="CollectionPath">
<String>Currencies</String>
</PropertyValue>
<PropertyValue Property="Parameters">
<Collection>
<Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty">
<PropertyPath>currency_code</PropertyPath>
</PropertyValue>
<PropertyValue Property="ValueListProperty">
<String>code</String>
</PropertyValue>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty">
<String>name</String>
</PropertyValue>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
<Annotation Term="Core.Description">
<String>Currency code as specified by ISO 4217</String>
</Annotation>
</Annotations>
<Annotations Target="project.EntityContainer/SalesOrders">
<Annotation Term="Capabilities.DeleteRestrictions">
<Record Type="Capabilities.DeleteRestrictionsType">
<PropertyValue Property="Deletable">
<Bool>false</Bool>
</PropertyValue>
</Record>
</Annotation>
<Annotation Term="Capabilities.InsertRestrictions">
<Record Type="Capabilities.InsertRestrictionsType">
<PropertyValue Property="Insertable">
<Bool>false</Bool>
</PropertyValue>
</Record>
</Annotation>
<Annotation Term="Capabilities.UpdateRestrictions">
<Record Type="Capabilities.UpdateRestrictionsType">
<PropertyValue Property="Updatable">
<Bool>false</Bool>
</PropertyValue>
</Record>
</Annotation>
</Annotations>
</Schema>
</edmx:DataServices>
</edmx:Edmx>

Related

Smart Filter Bar does not appear

I am trying to use SmartFilterBar as follows:
<VBox fitContainer="true">
<smartFilterBar:SmartFilterBar id="JobProfileOverviewFilter" entitySet="ProfileSet">
<smartFilterBar:controlConfiguration>
<smartFilterBar:ControlConfiguration key="Item"></smartFilterBar:ControlConfiguration>
</smartFilterBar:controlConfiguration>
<smartFilterBar:layoutData>
<FlexItemData shrinkFactor="0"/>
</smartFilterBar:layoutData>
</smartFilterBar:SmartFilterBar>
<smartTable:SmartTable id="JobProfileOverview" entitySet="ProfileSet" tableType="ResponsiveTable" useTablePersonalisation="true"
showRowCount="true" enableAutoBinding="true" smartFilterId="JobProfileOverviewFilter" header="Business profiles"
class="sapUiResponsiveContentPadding" app:useSmartToggle="true">
<smartTable:customToolbar>
<OverflowToolbar design="Transparent">
<ToolbarSpacer/>
<OverflowToolbarButton icon="sap-icon://order-status" tooltip="Order status" text="Order status" press="onStatus"/>
</OverflowToolbar>
</smartTable:customToolbar>
<!-- layout data used to make the table growing but the filter bar fixed -->
<smartTable:layoutData>
<FlexItemData growFactor="1" baseSize="0%"/>
</smartTable:layoutData>
<Table mode="MultiSelect"></Table>
</smartTable:SmartTable>
</VBox>
The problem is, the filter does not appear on the screen.
the cutout from the metadata:
<EntityType Name="Profile" sap:content-version="1">
<Key>
<PropertyRef Name="ItemId"/>
</Key>
<Property Name="Item" Type="Edm.String" Nullable="false" MaxLength="300" sap:unicode="false" sap:label="Role" sap:creatable="false"
sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="Connector" Type="Edm.String" Nullable="false" MaxLength="32" sap:unicode="false" sap:label="System" sap:creatable="false"
sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="Descn" Type="Edm.String" Nullable="false" sap:unicode="false" sap:label="Description" sap:creatable="false"
sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="ValidFrom" Type="Edm.DateTime" Nullable="false" Precision="7" sap:unicode="false" sap:label="Valid From"
sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="ValidTo" Type="Edm.DateTime" Nullable="false" Precision="7" sap:unicode="false" sap:label="Valid To" sap:creatable="false"
sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="Status" Type="Edm.String" Nullable="false" MaxLength="8" sap:unicode="false" sap:label="Expiration Status"
sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="Selected" Type="Edm.String" Nullable="false" MaxLength="1" sap:unicode="false" sap:label="Boolean" sap:creatable="false"
sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="ItemId" Type="Edm.String" Nullable="false" MaxLength="50" sap:unicode="false" sap:label="Object ID" sap:creatable="false"
sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="ItemType" Type="Edm.String" Nullable="false" MaxLength="6" sap:unicode="false" sap:label="Item Type" sap:creatable="false"
sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
</EntityType>
<EntitySet Name="ProfileSet" EntityType="YGAC_ACCESS_MANAGER_SRV.Profile" sap:creatable="false" sap:updatable="false" sap:deletable="false"
sap:pageable="false" sap:content-version="1"/></EntityContainer>
What am I doing wrong?
Update
I have enabled the filter now
But it does not appear in SmartFilter:
I have to enable it in the filter option:
Why the filter fields do not get shown as default?
Try to add other parameters, for example:
<smartFilterBar:ControlConfiguration
key="Item"
mandatory="auto"
preventInitialDataFetchInValueHelpDialog="false"
visibleInAdvancedArea="true"
controlType="auto"
displayBehaviour="idAndDescription"
label="Item"
index="1"></smartFilterBar:ControlConfiguration>

Smart fields that are rendered as drop down does not show description

I have a smart field that I defined like this:
<smartField:SmartField value="{MarktID}" textInEditModeSource="ValueList" >
<smartField:configuration>
<smartField:Configuration preventInitialDataFetchInValueHelpDialog="false" displayBehaviour="idAndDescription"/>
</smartField:configuration>
</smartField:SmartField>
it's rendered like this (i.e. as drop down or select):
because I have this definition in my annotation file:
<Annotations Target="Metadata.Meldungen/MarktID">
<Annotation Term="Common.ValueListWithFixedValues" Bool="true"/>
<Annotation Term="Common.ValueList">
<Record>
<PropertyValue Property="CollectionPath" String="MarktSet"/>
<PropertyValue Property="Parameters">
<Collection>
<Record Type="Common.ValueListParameterOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="MarktID"/>
<PropertyValue Property="ValueListProperty" String="ID"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="Name"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations>
The question is how can I show the name of the selected item also in the drop down. I mean instead of showing 1300 (1300) (as can be seen in the picture) I want to show 1300 (Cimt Handelsgruppe) in the drop down itself.
It seems at the moment it does not know what to show in the parenthesis!?
Eventually I found the solution!
Here is the definition of entity that contains the data regarding the drop-down:
<EntityType Name="Markt" sap:content-version="1">
<Key>
<PropertyRef Name="ID"/>
</Key>
<Property Name="ID" Type="Edm.String" Nullable="false" MaxLength="4" sap:display-format="UpperCase" sap:label="ID" sap:text="Name"/>
<Property Name="Name" Type="Edm.String" Nullable="false" sap:label="Name"/>
</EntityType>
What was missing in my definition was sap:text="Name". By adding this small property the smart field know it has to show which property as description when the displayBehaviour is equal idAndDescription or descriptionAndId.
Finally I had what I wanted:

How to use smartfilterbar and smarttable?

I have EntitySet and would like to connect to SmartFilterBar and SmartTable. The EntitySet looks like:
<EntitySet Name="I_PMContactCardEmployee" EntityType="EAM_MALFUNCTION_MANAGE.I_PMContactCardEmployeeType" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:searchable="true" sap:content-version="1"/>
The EntityType:
<EntityType Name="I_PMContactCardEmployeeType" sap:label="Mitarbeiter" sap:content-version="1">
<Key>
<PropertyRef Name="PersonnelNumber"/>
</Key>
<Property Name="PersonnelNumber" Type="Edm.String" Nullable="false" MaxLength="8" sap:display-format="NonNegative" sap:text="EmployeeFullName" sap:label="Personalnummer"/>
<Property Name="EmployeeFullName" Type="Edm.String" MaxLength="80" sap:label="Vollständiger Name" sap:filterable="false"/>
<Property Name="FirstName" Type="Edm.String" MaxLength="40" sap:label="Vorname" sap:quickinfo="Vorname des Geschäftspartners (Person)"/>
<Property Name="FamilyName" Type="Edm.String" MaxLength="40" sap:label="Nachname" sap:quickinfo="Nachname des Geschäftspartners (Person)"/>
<Property Name="Job" Type="Edm.String" MaxLength="8" sap:display-format="NonNegative" sap:label="Stellenschlüssel" sap:quickinfo="Stelle" sap:filterable="false"/>
<Property Name="JobName" Type="Edm.String" MaxLength="25" sap:label="Stellenbezeichnung" sap:filterable="false"/>
<Property Name="CompanyCode" Type="Edm.String" MaxLength="4" sap:display-format="UpperCase" sap:text="CompanyCodeName" sap:label="Buchungskreis"/>
<Property Name="CompanyCodeName" Type="Edm.String" MaxLength="25" sap:label="Name der Firma" sap:quickinfo="Buchungskreis- oder Firmen-Bezeichnung" sap:filterable="false"/>
<Property Name="OrganizationalUnit" Type="Edm.String" MaxLength="8" sap:display-format="NonNegative" sap:label="Organisationseinheit"/>
<Property Name="OrganizationalUnitName" Type="Edm.String" MaxLength="25" sap:label="OrgEinheitenkurztext" sap:quickinfo="Organisationseinheitenkurztext" sap:filterable="false"/>
<Property Name="PhoneNumber" Type="Edm.String" MaxLength="30" sap:display-format="UpperCase" sap:label="Telefon" sap:quickinfo="Telefonnummer: Vorwahl+Anschluß" sap:filterable="false"/>
<Property Name="NormalizedPhoneNumber" Type="Edm.String" MaxLength="30" sap:display-format="UpperCase" sap:label="Telefonnummer" sap:quickinfo="Vollständige Nummer: Vorwahl+Anschluß+Durchwahl" sap:filterable="false"/>
<Property Name="MobilePhoneNumber" Type="Edm.String" MaxLength="30" sap:display-format="UpperCase" sap:label="Telefon" sap:quickinfo="Telefonnummer: Vorwahl+Anschluß" sap:filterable="false"/>
<Property Name="MblNormalizedPhoneNumber" Type="Edm.String" MaxLength="30" sap:display-format="UpperCase" sap:label="Telefonnummer" sap:quickinfo="Vollständige Nummer: Vorwahl+Anschluß+Durchwahl" sap:filterable="false"/>
<Property Name="DefaultEmailAddress" Type="Edm.String" MaxLength="241" sap:label="E-Mail-Adresse"/>
<Property Name="UserID" Type="Edm.String" MaxLength="12" sap:display-format="UpperCase" sap:label="Benutzer-ID" sap:filterable="false"/>
</EntityType>
and the view looks like:
<smartFilterBar:SmartFilterBar id="smartFilterBar" entitySet="malfunc>I_PMContactCardEmployee" persistencyKey="SmartFilterPKey">
<smartFilterBar:controlConfiguration>
<smartFilterBar:ControlConfiguration key="PersonnelNumber" visibleInAdvancedArea="true" preventInitialDataFetchInValueHelpDialog="false"></smartFilterBar:ControlConfiguration>
</smartFilterBar:controlConfiguration>
</smartFilterBar:SmartFilterBar>
<smartTable:SmartTable id="smartTable_ResponsiveTable" smartFilterId="smartFilterBarr" tableType="ResponsiveTable" editable="false"
entitySet="malfunc>I_PMContactCardEmployee" useVariantManagement="true" useTablePersonalisation="true" header="Products" showRowCount="true"
useExportToExcel="false" enableAutoBinding="true" persistencyKey="SmartTablePKey"></smartTable:SmartTable>
the service is registered as:
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"settings": {
"bundleName": "example.com.smartemployee.i18n.i18n"
}
},
"malfunc": {
"uri": "/sap/opu/odata/sap/EAM_MALFUNCTION_MANAGE/",
"type": "sap.ui.model.odata.v2.ODataModel",
"settings": {
"defaultOperationMode": "Server",
"defaultBindingMode": "OneWay",
"defaultCountMode": "Request"
},
"dataSource": "EAM_MALFUNCTION_MANAGE",
"preload": true
}
},
to get the data from the service, in the postman I called:
and get all of employees.
When I execute the application, SmartFilterBar and SmartTable is not working correctly.
It shows just an empty filterbar. What am I doing wrong?
As far as I know it is better to define the ODataModel as the default model.
"malfunc": {
"uri": "/sap/opu/odata/sap/EAM_MALFUNCTION_MANAGE/",
"type": "sap.ui.model.odata.v2.ODataModel",
"settings": {
"defaultOperationMode": "Server",
"defaultBindingMode": "OneWay",
"defaultCountMode": "Request"
},
"dataSource": "EAM_MALFUNCTION_MANAGE",
"preload": true
}
Also, assuming that your EntitySet is called "I_PMContactCardEmployeeSet", you have to specifiy that EntitSet in the SmartFilterBar and SmartTable properties:
entitySet="I_PMContactCardEmployeeSet"

SAPUI5 - mockup server

I'm following this Mockup Server tutorial for SAPUI5. But I'm not able to retrieve the data and set it to my model. Here's what I do:
I have slightly changed the data so, so two things have to be changed:
json data - Person.json:
{ "id":1,
"first_name":"Chris",
"last_name":"Johnston", "email":"cjohnston0#dailymotion.com", "gender":"Male", "ip_address":"119.220.205.173" }
emphasized text
``
<edmx:Edmx Version="1.0"
xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"/>
<edmx:DataServices m:DataServiceVersion="1.0"
m:MaxDataServiceVersion="3.0">
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<Schema Namespace="PersonsData" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
<EntityType Name="Person">
<Key>
<PropertyRef Name="id"/>
</Key>
<Property name="id" Type="Edm.Int16" Nullable="false" />
<Property Name="first_name" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true"/>
<Property Name="last_name" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true"/>
<Property Name="email" Type="Edm.String" Nullable="false"/>
<Property Name="gender" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false"/>
<Property Name="ip_address" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true"/>
</EntityType>
</Schema>
<Schema Namespace="databinding.PersonsData.Model" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
<EntityContainer Name="PersonEntities" m:IsDefaultEntityContainer="true" p6:LazyLoadingEnabled="true"
xmlns:p6="http://schemas.microsoft.com/ado/2009/02/edm/annotation">
<EntitySet Name="Persons" EntityType="PersonsData.Invoice"/>
</EntityContainer>
</Schema>
</edmx:DataServices>
The SAPUI5 Web IDE says that edmx namespace does not exist.
So I went to check edmx namespace and it does not exists.
Chrome developer tools reports the same error:
Could this be the problem?
I checked and mockserver.init() is triggered.
Did Microsoft moved this namespace somewhere? Cause I was not able to find it.
Thanks
what I see is that you messed up your XML structure. As the error says your XML is invalid.
You've closed the surrounding edmx:Edmx tag at the beginning of the document
You've closed the edmx:DataServices tag too early
Furthermore the attribute name of the property id is in lowercase. Try to make an uppercased Name.
Try to use this xml:
<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">
<edmx:DataServices m:DataServiceVersion="1.0" m:MaxDataServiceVersion="3.0"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<Schema Namespace="PersonsData" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
<EntityType Name="Person">
<Key>
<PropertyRef Name="id"/>
</Key>
<Property Name="id" Type="Edm.Int16" Nullable="false"/>
<Property Name="first_name" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true"/>
<Property Name="last_name" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true"/>
<Property Name="email" Type="Edm.String" Nullable="false"/>
<Property Name="gender" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false"/>
<Property Name="ip_address" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true"/>
</EntityType>
</Schema>
<Schema Namespace="databinding.PersonsData.Model" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
<EntityContainer Name="PersonEntities" m:IsDefaultEntityContainer="true" p6:LazyLoadingEnabled="true"
xmlns:p6="http://schemas.microsoft.com/ado/2009/02/edm/annotation">
<EntitySet Name="Persons" EntityType="PersonsData.Invoice"/>
</EntityContainer>
</Schema>
</edmx:DataServices>

How does odata know which property is the ID?

In the following example russelwhyte is the id, but how does the provider know to map it to the UserName property?
URL: http://services.odata.org/V4/TripPinServiceRW/People?$format=application/json;odata.metadata=full
Response:
{
#odata.context: "http://services.odata.org/V4/(S(ck3fzk3dze0kmzjcruxiz31i))/TripPinServiceRW/$metadata#People",
#odata.nextLink: "http://services.odata.org/V4/TripPinServiceRW/People?%24format=application%2fjson%3bodata.
metadata%3dfull&%24skiptoken=8",
value:
[
{
#odata.type: "#Microsoft.OData.SampleService.Models.TripPin.Person",
#odata.id: "http://services.odata.org/V4/TripPinServiceRW/People('russellwhyte')",
#odata.etag: "W/"08D17DBDFB9CCAAC"",
#odata.editLink: "http://services.odata.org/V4/TripPinServiceRW/People('russellwhyte')",
UserName: "russellwhyte",
FirstName: "Russell",
LastName: "Whyte",
...
Friends#odata.associationLink: "http://services.odata.org/V4/TripPinServiceRW/People('russellwhyte')/Friends/$ref",
Friends#odata.navigationLink: "http://services.odata.org/V4/TripPinServiceRW/People('russellwhyte')/Friends",
...
},
...
]
}
By overriding GetEntityByKey of the base class EntitySetController
Query the metadata document, you can get the model schema for the service, and in which you can find which properties are the keys/IDs.
For example:
GET: http://services.odata.org/V4/(S(ksn5grnrgbebt44osly5z2vr))/TripPinServiceRW/$metadata
<EntityType Name="Person" OpenType="true">
<Key>
<PropertyRef Name="UserName"/>
</Key>
<Property Name="UserName" Type="Edm.String" Nullable="false">
<Annotation Term="Org.OData.Core.V1.Permissions">
<EnumMember>Org.OData.Core.V1.Permission/Read</EnumMember>
</Annotation>
</Property>
<Property Name="FirstName" Type="Edm.String" Nullable="false"/>
<Property Name="LastName" Type="Edm.String" Nullable="false"/>
<Property Name="Emails" Type="Collection(Edm.String)"/>
<Property Name="AddressInfo" Type="Collection(Microsoft.OData.SampleService.Models.TripPin.Location)"/>
<Property Name="Gender" Type="Microsoft.OData.SampleService.Models.TripPin.PersonGender"/>
<Property Name="Concurrency" Type="Edm.Int64" Nullable="false">
<Annotation Term="Org.OData.Core.V1.Computed" Bool="true"/>
</Property>
<NavigationProperty Name="Friends" Type="Collection(Microsoft.OData.SampleService.Models.TripPin.Person)"/>
<NavigationProperty Name="Trips" Type="Collection(Microsoft.OData.SampleService.Models.TripPin.Trip)" ContainsTarget="true"/>
<NavigationProperty Name="Photo" Type="Microsoft.OData.SampleService.Models.TripPin.Photo"/>
</EntityType>