Skip to Content

Read the default model in Sap Web Ide

Jun 01, 2017 at 05:47 AM


avatar image
Former Member


I would like your help to access models in the Sap Web Ide, using the manifest.json. Previously, I used to instantiate a JSONModel and then could access this model using its ID.

var oUserDataModel = new sap.ui.model.json.JSONModel(data);
sap.ui.getCore().setModel(oUserDataModel, "UserData");

var modelUser = sap.ui.getCore().getModel("UserData");

However, using the manifest.json, especially when it is the default model, I don't know how to access this model in order to make some changes in its structure.

Is it possible to do read models in the same way with these created in manifest? For example...

var modelUser = sap.ui.getCore().getModel("Default");

And when it isn't a default model? What would change?

I have attached a print screen of my manifest.json, with an example from Northwind oData.

Thank you in advance, Rogerio

duvida.png (16.8 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
avatar image
Former Member Jun 01, 2017 at 06:00 AM


I can see you are instantiating OData Model as default model.

So if you are accessing the model from Component controller, you can access it using below code :

var oModel = this.getModel();

If you want to access it in controllers, use below code :

var oModel = this.getOwnerComponent().getModel();

As your Odata model is a default model, no need to pass any model name in getModel() method.

I hope you are clear with the above explanation.


Karan Shaheri.

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Karan,

it worked, thank you.

If it wasn't a default model, what would change please?

Thank you