Skip to Content
avatar image
Former Member

how to bind xsodata in sapui5 table?

I am trying to bind xsodata in sapui5, but i don't know how to instantiate xsodata model in it . Also, is it possible to perform create and update operation with the help of xsodata in sap hana database from sapui5

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Aug 01, 2017 at 10:54 AM

    Hi Naresh,

    As rightly mentioned by Srikanth, there is no much difference between how to evoke and use a web service or an xsodata file.

    For your better understanding i have created a small mock up, this i'm doing in controller to save time, you can do it manifest.json which is adviced.

    Hope the below code works for you, Note: I have used sap.ui.table library for this. Please do let me know if you need further assistance on the same.

    Thanks,

    Ashwin

    <<XSODATA File>>
    service{
    "Your package Name::Your calculation View Name" as "Entity"
    keys generate local "genID";
    }
    ----------------------------------------------
    <<Controller file>>
    onAfterRendering:function(){
    var oTableInstance = this.getView().byId("your table id");
    var oModelName= new sap.ui.model.odata.ODataModel("/path to xsodata file.xsodata", true);
      oTableInstance.setModel(oModelName);
      oTableInstance.bindRows("/ENTITY");
    }
    Add comment
    10|10000 characters needed characters exceeded

  • Jul 31, 2017 at 05:44 PM

    XSOData model instantiation in UI5 like any other v2 OData model... there is no difference in model instantiation on UI5 between Gateway and XSOData.

    Create a model entry in manifest.json and point the metadata url to XSOData on HANA

    CRUD operations can be performed on XSOData for catalog objects like tables only. It is possible to write OData exits that contains any custom code using XSJS for Create and update operations

    Add comment
    10|10000 characters needed characters exceeded