Skip to Content
avatar image
Former Member

Smart Table with Northwind odata giving error

Hi All,

I am developing smart table control with Northwind OData service when i run this application i am getting some error i am posting that screen shot please look on it.

And my code is :

View :

<smartTable:SmartTable id="smartTable_ResponsiveTable" smartFilterId="smartFilterBar" tableType="ResponsiveTable" editable="false" entitySet="Products" useVariantManagement="false" useTablePersonalisation="false" header="Products" showRowCount="true" useExportToExcel="false" enableAutoBinding="true"></smartTable:SmartTable>

metadata.xml

<?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" xmlns:p8="http://schemas.microsoft.com/ado/2009/02/edm/annotation"> 

<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="com.sap.wt05" sap:schema-version="1" xmlns="http://schemas.microsoft.com/ado/2008/09/edm"> 

<EntityType Name="Product"> 

<Key> <PropertyRef Name="ProductID"/> </Key>

 <Property Name="ProductID" Type="Edm.String" sap:filterable="false" sap:visible="true"/> <Property Name="ProductName" Type="Edm.String" MaxLength="30" sap:label="ProductName" sap:filterable="false" /> <Property Name="CategoryID" Type="Edm.String" sap:label="CategoryID" sap:filterable="true" /> <Property Name="UnitPrice" Type="Edm.String" MaxLength="3" sap:label="UnitPrice" sap:filterable="false" /> 

</EntityType> 

<EntityContainer m:IsDefaultEntityContainer="true" sap:supported-formats="atom json"> 

<EntitySet Name="Products" EntityType="com.sap.wt05.Product"/>

 </EntityContainer> 

<Annotations Target="com.sap.wt05.Product" xmlns="http://docs.oasis-open.org/odata/ns/edm"> <Annotation Term="com.sap.vocabularies.UI.v1.LineItem"> <Collection> <Record Type="com.sap.vocabularies.UI.v1.DataField"> <PropertyValue Property="Value" Path="ProductID"/> </Record> <Record Type="com.sap.vocabularies.UI.v1.DataField"> <PropertyValue Property="Value" Path="UnitPrice" /> </Record> <Record Type="com.sap.vocabularies.UI.v1.DataField"> <PropertyValue Property="Value" Path="ProductName" /> </Record> <Record Type="com.sap.vocabularies.UI.v1.DataField"> <PropertyValue Property="Value" Path="CategoryID" /> </Record> </Collection> </Annotation> </Annotations> <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="self” href=”http://services.odata.org/V2/Northwind/Northwind.svc/$metadata"/> 

</Schema> 

</edmx:DataServices>

 </edmx:Edmx>

manifest.json :

"dataSources": {
			"mainService": {
				"uri": "/destinations/northwind/V2/Northwind/Northwind.svc/",
				"type": "OData",
				"settings": {
					"odataVersion": "2.0",
					"localUri": "test/metadata.xml"
				}
			}
		}

This is my code please look on it and resolve my issue.

Regards,

Sai Ram Dinesh Pallapotu

capture.png (21.2 kB)
Add comment
10|10000 characters needed characters exceeded

  • Former Member

    Hi All,

    Like above i'm trying to develop smart controls using JSON Model data that is instead of OData. This time without annotations and by using <itiallyVisibleFields="id,name"> i'm trying to show the data but i'm getting same error like above that is "There are no columns....."

    Please say how to achieve this functionality.

    Regards,
    Sai Ram Dinesh Pallapotu

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Nov 28, 2016 at 02:58 PM

    The northwind oData is not annotated. You need to annotate it in a separate annotations file e.g. annotation.xml (rather then the metadata.xml as you are doing just now) and then link it to your data source in manifest.json. If you are using WEB IDE then you can use the following: Annotation Modeller and when you create it should link it automatically. The metadata.xml file should have the annotations only if they are annotated in the backend and you have manually added it in there.

    I know the documentation of Smart Table is very poor and it is hard to get your head around. The annotations are only telling which columns of the table should be initially visible. You can achieve the same by using property initiallyVisibleFields of the Smart Table

    Check the following code. It should display the product name.

    <sap.ui.comp.smarttable:SmartTable xmlns:sap.ui.comp.smarttable="sap.ui.comp.smarttable" 
    				tableType="ResponsiveTable" header="Smart Table"
    				enableAutoBinding="true" id="table" 
    				entitySet="Products" initiallyVisibleFields="ProductName"/>
    Add comment
    10|10000 characters needed characters exceeded

    • Create local annotation file and then in annotation modeller add "UI.LineItem" to define initially visible columns.

      <Annotation Term="UI.LineItem">
      	<Collection>
      		<Record Type="UI.DataField">
      			<PropertyValue Property="Label" String="Product"/>
      			<PropertyValue Property="Value" Path="ProductID"/>
      		</Record>
      	</Collection>
      </Annotation>
      
      

      Regards,

      Anete

  • avatar image
    Former Member
    Dec 22, 2016 at 02:47 PM

    Hello Sai Ram Dinesh,

    Anete has described a workaround by using the code editor. Of course this is a valid workaround.
    But I'm glad to inform you that we meanwhile fixed the bug at the Annotation Editor too: it now looks for the entityContainer through all schemas. This fix should already be present in the WebIDE.

    Best regards,

    Stefan

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Stefan,

      Thank you so much for informing about this :). I tried in WebIDE and I'm able to do code annotation file using Annotation Modeler.

      I have another issue please see following link.

      https://answers.sap.com/questions/90310/index.html

      In above I have used OData service and able to work with smart table and Annotation Modeler but now I have to use the JSONModel. In this case please suggest me how to use smart table and Annotation Modeler (or how to write annotation.xl manually) to use JSONModel in my application.

      Regards,
      Sai Ram Dinesh Pallapotu

  • avatar image
    Former Member
    Feb 15, 2017 at 04:49 PM

    Hi,

    I have a little different requirement, my odata version is V2 and service is created without vocabulary so no annotation are part of odata service metadata.

    my question is

    1. Can I use create a local annotation to have intial fields, value list so on with smart tabel

    2. then data will come from odata

    so data to smart table is from odata service, metadata is on local can this combination work for smart table? if yes please provide steps for the same.

    Thank you,

    BG

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 13, 2017 at 08:44 AM

    Hello Basavaraja,

    If you plan to use the smart table, you indeed need annotations - being local or coming from any backend system.
    You can use a local annotation file in this case (at least as long as you are not working on SAP applications, then you would have to consider more constraints with regards to layering and delivery).
    Note the option of the WebIDE to create a local annotation via the context menu New > Annotation File.

    But in any case these annotation files MUST refer to a vocabulary, the references must be part of the annotation edmx.
    If you follow the proposed way with the context menu, a template will be applied that leads to an annotation file comprising the standard references.

    Add comment
    10|10000 characters needed characters exceeded