Skip to Content

Smart Table in UI5

Hi All,

                The Smart Table is the table Generated based on oData metadata.

So, explicitly creating rows and columns not required. It will creates the rows and columns based on oData metadata. If you want to do some customization it is allows to modify.

Reference –

Smart Table – UI Development Toolkit for HTML5 (SAPUI5) – SAP Library

SAPUI5 Explored

This is my Project Structure,

  1. Index.html,




              <meta http-equiv=“X-UA-Compatible” content=“IE=edge”>

              <meta http-equiv=‘Content-Type’ content=‘text/html;charset=UTF-8’/>

              <script src=





                          data-sap-ui-resourceroots=‘{“smarttable”: “./”}’




sap.ui.getCore().attachInit(function() {

              new sap.ui.core.ComponentContainer({

                        height : “100%”,

                        name : “smarttable”






      <body class=“sapUiBody” role=“application”>

              <div id=“content”></div>




sap.ui.core.UIComponent.extend(“smarttable.Component”, {

  init : function()


sap.ui.core.UIComponent.prototype.init.apply(this, arguments);

      var mConfig = this.getMetadata().getConfig();


createContent : function() {

    return new sap.m.App({id :“idApp”,pages: [

sap.ui.view({id : “idsmarttable”, viewName : “smarttable.smarttable.SmartTable”, type : sap.ui.core.mvc.ViewType.XML, viewData : this }),





<core:View xmlns:core=“sap.ui.core” xmlns=“sap.m”

      xmlns:smartFilterBar=“sap.ui.comp.smartfilterbar” xmlns:smartTable=“sap.ui.comp.smarttable”



      controllerName=“smarttable.smarttable.SmartTable” height=“100%”>

      <Page id=“page” title=“SmartTable – Customer Line Items”




              “TableList” is the EntitySet name to get the table values           


                    <smartTable:SmartTable entitySet=“TableList”

                          smartFilterId=“smartFilterBar” tableType=“Table” useExportToExcel=“true”

                          useVariantManagement=“false” useTablePersonalisation=“true” header=“Line Items”

                          showRowCount=“true” persistencyKey=“SmartTableAnalytical_Explored”

                          enableAutoBinding=“true” />





sap.ui.controller(“smarttable.smarttable.SmartTable”, {

      onInit: function() {

              var oModel, oView;

                  oModel = new sap.ui.model.odata.ODataModel(“YOUR URL”, true);


                  oView = this.getView();





You must be Logged on to comment or reply to a post.
    • Dear Arshad,

           Thanks for your feed back.

      From the front end, we can't pass any values for the Annotations. Annotations are did by Gateway Server side. so. if you want to see or change any of these Annotations values- Please login to your gateway server, t-code 'segw'. select your project->Data Model-> Entity Set-> Select your you will see all your Annotations. And if you want you can change,

      • Thanks

        I know that but there are certain annotations which are not sap annotations. We have to create vocbulory basd annotation project in GW and import vocabulory libraries  . But there are a lot of annotations and I am not able to decide which annotation makes sense for this smart table/ smart filter.


        If you could paste the <server>/$metadata xml  it would be helpful

          • Hi Santosh,

            Above you have discussed how to create annotations while working with ABAP Netweaver Gateway. Can we also create similar type of annotations using HANA XSODATA ? Can you guide how we can do so

          • And I would like to add to what Arshad wrote - I didn't find any practical documentation about these must have annotations.

            For example, it took me some time to discover that if the metadata.xml doesn't include the annotations "sap:semantics="aggregate" on the EntitySet and "sap:aggregation-role="dimention" on the relevant properties, the smart table with type Analytical Table will just not work properly...

            So building and understanding the metadata file is critical and unfortunately is not clear/well documented anywhere..

  • Hi,

    Could you please please please change your blog font to something more readable than Comic Sans? Especially the code snippets are impossible to read...

  • Hi,

    From the 2nd screen shot from the last, looks like you have to select the fields to be selected for the first time. Which is the same issue I have. Do you know how to set up a default variant to be used?



  • Hello,

    First of all, thanks for your blog, it saved my time 🙂

    I have a question, how to set by default columns and columns order ? (maybe I do not understand something)

    Kind Regards,

  • Hi Santhosh,

    I have used smart template and I have noticed that the getEntitySet is been triggered as soon as the SmartTable is visible. Our requirement is that the service call should be triggered explicitly on press of Go with some mandatory filter parameters.

    I have followed above link and tried to prevent the binding with mBindingParams.preventTableBind

    = 'true' but I am not able to rebind the table.

    Have you faced such scenario. Please let us know.

    With Regards,

    Ramesh Shrestha

  • Hi Santhosh,

    After binding I able to see the columns are dynamically loaded from metdata to the smart table but am not able to understand how to bind data from an oData read service.

    Please help me.



  • /
    • Hi Shahid,

      This error is asking you to have at least one column to be selected for smart table. In smart table columns are defined in the metadata so you can set few columns to be default by changing metadata. Or if you are generating metadata through some annotation then better to have it. Another option is just to ignore this error. Then press setting buttons on the smart table, then add columns as personnelization.

      • Hi Ramesh,

        Can you suggest, how i can modify metadata to display some columns as default,

        I am using annotation for smart table in metadata as shown below

        <Annotations xmlns="" Target="...............">

             <Annotation Term="">


                       <Record Type="">

                            <PropertyValue Property="Value" Path="CustomerId"/>

                            <PropertyValue Property="Label" String="CustomerId"/>


                       <Record Type="">

                            <PropertyValue Property="Value" Path="CustomerName"/>

                            <PropertyValue Property="Label" String="CustomerName"/>





        I can  ignore this error and from setting buttons on the smart table i can display data,

        But i need to display data by default


    • Hi shahid,


      Please re-check the EntitySet for the Smart table. It should name of the EntitySet and not EntityType.

      <smartTable:SmartTable id ="smartTable" entitySet="Employees"

      tableType="Table" useExportToExcel="true"

      useVariantManagement="false" useTablePersonalisation="true" header="LineItems"

      showRowCount="true" persistencyKey="SmartTableAnalytical_Explored"

      enableAutoBinding="true" />


  • Hello Santhosh,

    i tried the above link but m getting error .

    'initialise' no personalizable component available - 

    DOM is not ready yet. Static UIArea cannot be created.

    Popup cannot be opened because static UIArea cannot be determined.


    Rewati Raman