cancel
Showing results for 
Search instead for 
Did you mean: 

how to bind xsodata in sapui5 table?

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

ashwin_narayan
Participant
0 Kudos

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");
}
Former Member
0 Kudos

Hii Ashwin,

Thanks for your help,

yes by this way ,I am able to bind the data to sapui5. But,can you help me in performing create and update operation with the help of xsodata in the hana database.

Now, I am trying to fill data in the inputs of sapui5 frontend , which must get created in hana database table.This is what i am trying to achieve. Can you help me in this?

thanks,

Naresh

ashwin_narayan
Participant
0 Kudos

Hi Naresh,

Glad that it worked for you. Getting back to your requirement I have came across a blog which serves the exact purpose and will perfectly suit your requirement.

CRUD Operations With XSODATA

All the best!!

Thanks,

Ashwin

Answers (1)

Answers (1)

former_member365727
Active Contributor
0 Kudos

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