on 05-19-2016 7:42 AM
Hi All,
By one of the tutorial, I could able to get Products data by using the url :
var sUrl = "http://services.odata.org/Northwind/Northwind.svc/Products"; Here, userid and password are not given and able to get data.
In the same way, I want to get data from a custom table using the following register service.
var sUrl = "http://x.y.com:8020/sap/opu/odata/sap/Z_LEAVE_CRUD_SRV/zleave_reqSet";
In this case, when I am trying to access data from my system, I thing we should give user id and password. So what code should be added to the follwoing or can we skip the authentication and get data as public access.
1. var sUrl = "http://services.odata.org/Northwind/Northwind.svc/Products";
2. var oModel = sap.ui.model.json.JSONModel(sUrl);
3. sap.ui.getCore().setModel(oModel);
4. this.getView().setModel(oModel);
How should I replace line 1, with my registered service url (http://x.y.com:8020/sap/opu/odata/sap/Z_LEAVE_CRUD_SRV/zleave_reqSet )
* either i want skip authentication or which code should be written to give user id and password so as to get data
Thanks,
Srinivas
Try this code.
var createUrl = "/sap/opu/odata/sap/ODataService ";
var createQuoteModel = new sap.ui.model.odata.ODataModel(createUrl, true,"userName", "Password");
sap.ui.getCore().setModel(createModel, " createModel ");
this.getView().byId("KDGRP_id").bindElement("/EntitySets('Provide your Input Values')");
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
U means Convert OData into JSON Mode?
If yes, We can convert.
onInit():
createContent():
Regards
Vijay
User | Count |
---|---|
80 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.