Skip to Content
2
Jun 02, 2016 at 10:25 PM

Generating annotations for SmartTable in XSOData

1194 Views

Hi All,

I need to write an XS OData service which will be consumed by a smart table in UI5. The UI5 smart controls require special annotations to be provided in the metadata. Can I please know how these annotations can be generated as part of the xs odata $metadata? If xsodata cannot provide this, how can we generate this metadata file? We are currently running on Hana XS Advanced (SP12).

I have already tried including the following code after the odata service definition, but this did not produce the required annotations:

annotations {
  enable OData4SAP;
}

Any help is greatly appreciated.

Thanks,

Isuru

PS - Here is a sample metadata file required by Smart Tables. Annotations are from line 28 to 45:

<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"
  xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:sap="http://www.sap.com/Protocols/SAPData">
  <edmx:Reference
  Uri="http://server:port/sap/opu/odata/IWFND/CATALOGSERVICE;v=2/Vocabularies(TechnicalName='%2FIWBEP%2FVOC_CORE',Version='0001',SAP__Origin='')/$value"
  xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
  <edmx:Include Namespace="com.sap.vocabularies.UI.v1" Alias="UI"/>
  </edmx:Reference>
  <edmx:DataServices m:DataServiceVersion="2.0">
  <Schema Namespace="SmartTbl" xml:lang="de" sap:schema-version="1 " xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
  <EntityType Name="Person" sap:content-version="1">
  <Key>
  <PropertyRef Name="PersonID"/>
  </Key>
  <Property Name="PersonID" Type="Edm.String" Nullable="false" sap:creatable="false" sap:updatable="false" sap:sortable="false"
  sap:filterable="false"/>
  <Property Name="FirstName" Type="Edm.String" Nullable="false" sap:visible="true" sap:creatable="false" sap:updatable="false"
  sap:sortable="false" sap:filterable="false"/>
  <Property Name="LastName" Type="Edm.String" Nullable="false" sap:visible="true" sap:creatable="false" sap:updatable="false"
  sap:sortable="false" sap:filterable="false"/>
  <Property Name="Birthday" Type="Edm.DateTime" Nullable="false" sap:visible="true" sap:creatable="false" sap:updatable="false"
  sap:sortable="false" sap:filterable="false"/>
  </EntityType>
  <EntityContainer Name="SmartTbl_Entities" m:IsDefaultEntityContainer="true" sap:supported-formats="atom json xlsx">
  <EntitySet Name="Persons" EntityType="SmartTbl.Person" sap:creatable="false" sap:updatable="false" sap:deletable="false"
  sap:pageable="false" sap:addressable="false" sap:content-version="1"/>
  </EntityContainer>
  <Annotations Target="SmartTbl.Person" xmlns="http://docs.oasis-open.org/odata/ns/edm">
  <Annotation Term="com.sap.vocabularies.UI.v1.LineItem">
  <Collection>
  <Record Type="UI.DataField">
  <PropertyValue Property="Value" Path="FirstName"/>
  <Annotation Term="UI.Importance" EnumMember="UI.Importance/High"/>
  </Record>
  <Record Type="UI.DataField">
  <PropertyValue Property="Value" Path="LastName"/>
  <Annotation Term="UI.Importance" EnumMember="UI.Importance/High"/>
  </Record>
  <Record Type="UI.DataField">
  <PropertyValue Property="Value" Path="Birthday"/>
  <Annotation Term="UI.Importance" EnumMember="UI.Importance/High"/>
  </Record>
  </Collection>
  </Annotation>
  </Annotations>
  </Schema>
  </edmx:DataServices>
</edmx:Edmx>