on 2015 Sep 23 5:20 AM
Hi, I am using eclipes and ui5 to develop application first i used "http://sap02:8000/sap/opu/odata/SAP/ZSL_EPM_DEMO_SRV/SalesOrderSet" there i got some error for which i mada below change var sUrl = "proxy/http/sap02:8000/sap/opu/odata/SAP/ZSL_EPM_DEMO_SRV/SalesOrderSet"; |
var oModel = sap.ui.model.json.JSONModel(sUrl,false,"","");
sap.ui.getCore().setModel(oModel);
.js
createContent : function(oController) {
var oTable = new sap.m.Table("idPrdList",{
inset : true ,
headerText : "List of Product",
headerDesign : sap.m.ListHeaderDesign.Standard,
mode : sap.m.ListMode.None,
includeItemInSelection : false});
var col1 = new sap.m.Column("col1",{header: new sap.m.Label({text:"Product Name"})});
oTable.addColumn(col1);
var col2 = new sap.m.Column("col2",{header: new sap.m.Label({text:"Decription"})});
oTable.addColumn(col2);
var col3 = new sap.m.Column("col3",{header: new sap.m.Label({text:"Price"})});
oTable.addColumn(col3);
var colItems = new sap.m.ColumnListItem("colItems",{type:"Active"});
oTable.bindAggregation("items","/value",colItems);
// var txtNAME = new sap.m.Text("txtNAME",{text:"{ProductID}"});
var txtNAME = new sap.m.Text("txtNAME",{text:"{SoId}"});
colItems.addCell(txtNAME);
// var txtNAME2 = new sap.m.Text("txtNAME2",{text:"{ProductName}"});
var txtNAME2 = new sap.m.Text("txtNAME2",{text:"{GrossAmount}"});
colItems.addCell(txtNAME2);
// var txtNAME3 = new sap.m.Text("txtNAME3",{text:"{UnitsInStock}"});
var txtNAME3 = new sap.m.Text("txtNAME3",{text:"{NetAmount}"});
colItems.addCell(txtNAME3);
return new sap.m.Page({
title: "Test First App",
content: [
oTable
]
});
}
.html
<script src="resources/sap-ui-core.js" id="sap-ui-bootstrap"
data-sap-ui-libs="sap.m" data-sap-ui-theme="sap_bluecrystal"
data-sap-ui-xx-bindingSyntax="complex">
</script>
<!-- only load the mobile lib "sap.m" and the "sap_bluecrystal" theme -->
<script>
sap.ui.localResources("demotable");
var app = new sap.m.App({initialPage:"iddemoTable1"});
var page = sap.ui.view({id:"iddemoTable1",
viewName:"demotable.demoTable",
type:sap.ui.core.mvc.ViewType.JS});
app.addPage(page);
app.placeAt("content");
</script>
Now i am getting below for which data is not binding.
Error in parsing value for 'display'. Declaration dropped. library.css:12:389
Error in parsing value for 'display'. Declaration dropped. library.css:12:426
Error in parsing value for 'animation'. Declaration dropped. library.css:12:2464
Error in parsing value for 'animation'. Declaration dropped. library.css:12:2903
Unknown property 'touch-action'. Declaration dropped. library.css:12:4705
Error in parsing value for 'text-align'. Declaration dropped. library.css:12:5026
Error in parsing value for 'display'. Declaration dropped. library.css:12:8737
Error in parsing value for 'display'. Declaration dropped. library.css:12:8774
Error in parsing value for 'display'. Declaration dropped. library.css:12:11210
Error in parsing value for 'display'. Declaration dropped. library.css:12:11230
Error in parsing value for 'display'. Declaration dropped. library.css:12:14803
Error in parsing value for 'display'. Declaration dropped. library.css:12:14840
Error in parsing value for 'display'. Declaration dropped. library.css:12:15315
Error in parsing value for 'display'. Declaration dropped. library.css:12:15352
Error in parsing value for 'display'. Declaration dropped. library.css:12:16134
Error in parsing value for 'display'. Declaration dropped. library.css:12:16171
Error in parsing value for 'line-height'. Declaration dropped. library.css:12:17947
Error in parsing value for 'line-height'. Declaration dropped. library.css:12:17986
Error in parsing value for 'display'. Declaration dropped. library.css:12:18496
Unknown property 'heigth'. Declaration dropped. library.css:12:19122
Error in parsing value for 'display'. Declaration dropped. library.css:12:20653
Error in parsing value for 'display'. Declaration dropped. library.css:12:20674
Unknown pseudo-class or pseudo-element '-webkit-outer-spin-button'. Ruleset ignored due to bad selector. library.css:12:23883
Unknown pseudo-class or pseudo-element '-ms-clear'. Ruleset ignored due to bad selector. library.css:12:24010
Unknown pseudo-class or pseudo-element '-webkit-input-placeholder'. Ruleset ignored due to bad selector. library.css:12:24213
Error in parsing value for 'display'. Declaration dropped. library.css:12:24475
Error in parsing value for 'display'. Declaration dropped. library.css:12:24512
Error in parsing value for 'display'. Declaration dropped. library.css:12:24806
Error in parsing value for 'display'. Declaration dropped. library.css:12:24843
Unknown property 'touch-action'. Declaration dropped. library.css:12:26508
Error in parsing value for 'display'. Declaration dropped. library.css:12:26723
Error in parsing value for 'display'. Declaration dropped. library.css:12:26743
Error in parsing value for 'display'. Declaration dropped. library.css:12:27386
Error in parsing value for 'display'. Declaration dropped. library.css:12:27406
Error in parsing value for 'display'. Declaration dropped. library.css:12:29197
Error in parsing value for 'display'. Declaration dropped. library.css:12:29234
Unknown property 'user-select'. Declaration dropped. library.css:12:29449
Error in parsing value for 'vertical-align'. Declaration dropped. library.css:12:48886
Error in parsing value for 'word-break'. Declaration dropped. library.css:12:50267
Error in parsing value for 'word-break'. Declaration dropped. library.css:12:50342
Unknown property 'hyphens'. Declaration dropped. library.css:12:50416
Error in parsing value for 'display'. Declaration dropped. library.css:12:51947
Error in parsing value for 'display'. Declaration dropped. library.css:12:51967
Error in parsing value for 'display'. Declaration dropped. library.css:12:63036
Error in parsing value for 'display'. Declaration dropped. library.css:12:63333
Error in parsing value for 'display'. Declaration dropped. library.css:12:63362
Unknown property 'box-flex'. Declaration dropped. library.css:12:63611
Unknown property 'box-flex'. Declaration dropped. library.css:12:63759
Unknown property 'touch-action'. Declaration dropped. library.css:12:64368
Unknown property 'user-select'. Declaration dropped. library.css:12:66447
Unknown pseudo-class or pseudo-element '-webkit-search-decoration'. Ruleset ignored due to bad selector. library.css:12:66603
Unknown property 'user-select'. Declaration dropped. library.css:12:70685
Unknown property 'user-select'. Declaration dropped. library.css:12:71298
Error in parsing value for 'display'. Declaration dropped. library.css:12:71742
Unknown property 'touch-action'. Declaration dropped. library.css:12:74108
Unknown property 'touch-action'. Declaration dropped. library.css:12:75163
Error in parsing value for 'display'. Declaration dropped. library.css:12:78575
Error in parsing value for 'display'. Declaration dropped. library.css:12:78612
Error in parsing value for 'display'. Declaration dropped. library.css:12:78750
Error in parsing value for 'display'. Declaration dropped. library.css:12:78787
Error in parsing value for 'display'. Declaration dropped. library.css:12:79245
Error in parsing value for 'display'. Declaration dropped. library.css:12:79282
Error in parsing value for 'display'. Declaration dropped. library.css:12:79882
Error in parsing value for 'display'. Declaration dropped. library.css:12:79919
Error in parsing value for 'word-break'. Declaration dropped. library.css:12:80792
Unknown property 'user-select'. Declaration dropped. library.css:12:83158
Unknown property 'touch-action'. Declaration dropped. library.css:12:83343
Unknown property 'speak'. Declaration dropped. library.css:12:83746
Error in parsing value for 'display'. Declaration dropped. library.css:12:87445
Error in parsing value for 'word-break'. Declaration dropped. library.css:12:87536
Unknown property 'touch-action'. Declaration dropped. library.css:12:88867
Error in parsing value for 'background'. Declaration dropped. library.css:12:92744
Error in parsing value for 'background'. Declaration dropped. library.css:12:92883
Error in parsing value for 'background'. Declaration dropped. library.css:12:92971
Error in parsing value for 'background'. Declaration dropped. library.css:12:93054
Expected 'none', URL, or filter function but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. library.css:12:93218
Error in parsing value for 'background'. Declaration dropped. library.css:12:93594
Error in parsing value for 'background'. Declaration dropped. library.css:12:93733
Error in parsing value for 'background'. Declaration dropped. library.css:12:93821
Error in parsing value for 'background'. Declaration dropped. library.css:12:93904
Expected 'none', URL, or filter function but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. library.css:12:94068
Unknown property 'user-select'. Declaration dropped. library.css:12:95358
Error in parsing value for 'display'. Declaration dropped. library.css:12:96806
Error in parsing value for 'display'. Declaration dropped. library.css:12:96827
Error in parsing value for 'display'. Declaration dropped. library.css:12:97037
Unknown property '-moz-flex'. Declaration dropped. library.css:12:99086
Unknown property '-moz-flex'. Declaration dropped. library.css:12:99300
Error in parsing value for '-moz-box-flex'. Declaration dropped. library.css:12:99517
Unknown property '-moz-flex'. Declaration dropped. library.css:12:99549
Error in parsing value for 'display'. Declaration dropped. library.css:12:112701
Error in parsing value for 'display'. Declaration dropped. library.css:12:112721
Error in parsing value for 'display'. Declaration dropped. library.css:12:112741
Error in parsing value for 'display'. Declaration dropped. library.css:12:112762
Error in parsing value for 'display'. Declaration dropped. library.css:12:112780
Error in parsing value for 'display'. Declaration dropped. library.css:12:112860
Error in parsing value for 'display'. Declaration dropped. library.css:12:112880
Error in parsing value for 'display'. Declaration dropped. library.css:12:112900
Error in parsing value for 'display'. Declaration dropped. library.css:12:112921
Error in parsing value for 'display'. Declaration dropped. library.css:12:112939
Unknown property '-moz-box-shadow'. Declaration dropped. library.css:12:115605
Unknown property '-moz-box-shadow'. Declaration dropped. library.css:12:115896
Unknown property '-moz-box-shadow'. Declaration dropped. library.css:12:116897
Unknown property '-moz-box-shadow'. Declaration dropped. library.css:12:117099
Expected 'none', URL, or filter function but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. library.css:12:121445
Error in parsing value for 'background'. Declaration dropped. library.css:12:121557
Error in parsing value for 'background'. Declaration dropped. library.css:12:121708
Expected color but found 'top'. Error in parsing value for 'background'. Declaration dropped. library.css:12:121811
Error in parsing value for 'background'. Declaration dropped. library.css:12:124362
Error in parsing value for 'background'. Declaration dropped. library.css:12:124421
Error in parsing value for 'background'. Declaration dropped. library.css:12:124522
Expected color but found 'top'. Error in parsing value for 'background'. Declaration dropped. library.css:12:124601
Expected color but found 'none'. Expected end of value but found 'none'. Error in parsing value for 'text-shadow'. Declaration dropped. library.css:12:129453
Unknown property 'user-select'. Declaration dropped. library.css:12:133805
Unknown property '-moz-user-drag'. Declaration dropped. library.css:12:133848
Unknown property 'user-drag'. Declaration dropped. library.css:12:133868
Unknown property '-moz-box-shadow'. Declaration dropped. library.css:12:134478
Unknown property '-moz-border-radius'. Declaration dropped. library.css:12:134598
Unknown property '-moz-border-radius'. Declaration dropped. library.css:12:135167
Unknown property '-moz-box-shadow'. Declaration dropped. library.css:12:135260
Unknown property '-moz-border-radius'. Declaration dropped. library.css:12:135835
Unknown property 'speak'. Declaration dropped. library.css:12:141957
Unknown property 'speak'. Declaration dropped. library.css:12:144348
Unknown property '-moz-box-shadow'. Declaration dropped. library.css:12:145166
Error in parsing value for 'background'. Declaration dropped. library.css:12:145293
Error in parsing value for 'background'. Declaration dropped. library.css:12:145446
Error in parsing value for 'background'. Declaration dropped. library.css:12:145617
Expected color but found 'top'. Error in parsing value for 'background'. Declaration dropped. library.css:12:145716
Expected 'none', URL, or filter function but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. library.css:12:145775
Unknown property '-moz-box-shadow'. Declaration dropped. library.css:12:146176
Unknown property '-moz-box-shadow'. Declaration dropped. library.css:12:146936
Error in parsing value for 'background'. Declaration dropped. library.css:12:147017
Error in parsing value for 'background'. Declaration dropped. library.css:12:147133
Error in parsing value for 'background'. Declaration dropped. library.css:12:147278
Expected color but found 'top'. Error in parsing value for 'background'. Declaration dropped. library.css:12:147364
Expected 'none', URL, or filter function but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. library.css:12:147410
Error in parsing value for 'background'. Declaration dropped. library.css:12:147557
Error in parsing value for 'background'. Declaration dropped. library.css:12:147749
Expected color but found 'top'. Error in parsing value for 'background'. Declaration dropped. library.css:12:147838
Expected 'none', URL, or filter function but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. library.css:12:147887
Error in parsing value for 'background'. Declaration dropped. library.css:12:149292
Error in parsing value for 'background'. Declaration dropped. library.css:12:149408
Error in parsing value for 'background'. Declaration dropped. library.css:12:149559
Expected color but found 'top'. Error in parsing value for 'background'. Declaration dropped. library.css:12:149648
Expected 'none', URL, or filter function but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. library.css:12:149697
Error in parsing value for 'background'. Declaration dropped. library.css:12:149904
Error in parsing value for 'background'. Declaration dropped. library.css:12:150020
Error in parsing value for 'background'. Declaration dropped. library.css:12:150165
Expected color but found 'top'. Error in parsing value for 'background'. Declaration dropped. library.css:12:150251
Expected 'none', URL, or filter function but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. library.css:12:150297
Error in parsing value for 'background'. Declaration dropped. library.css:12:151282
Error in parsing value for 'background'. Declaration dropped. library.css:12:151513
Error in parsing value for 'background'. Declaration dropped. library.css:12:151816
Expected color but found 'top'. Error in parsing value for 'background'. Declaration dropped. library.css:12:151981
Unknown property '-moz-box-shadow'. Declaration dropped. library.css:12:152429
Error in parsing value for 'cursor'. Declaration dropped. library.css:12:152701
Unknown property '-moz-box-shadow'. Declaration dropped. library.css:12:153070
Unknown property '-moz-box-shadow'. Declaration dropped. library.css:12:154658
Unknown property '-moz-box-shadow'. Declaration dropped. library.css:12:155356
Unknown pseudo-class or pseudo-element '-webkit-scrollbar'. Ruleset ignored due to bad selector. library.css:12:167396
Unknown property '-moz-border-radius'. Declaration dropped. library.css:12:173440
Unknown property 'speak'. Declaration dropped. library.css:12:178380
Unknown pseudo-class or pseudo-element '-webkit-input-placeholder'. Ruleset ignored due to bad selector. library.css:12:182171
Unknown pseudo-class or pseudo-element '-ms-input-placeholder'. Ruleset ignored due to bad selector. library.css:12:182357
Unknown pseudo-class or pseudo-element '-webkit-input-placeholder'. Ruleset ignored due to bad selector. library.css:12:183707
Unknown pseudo-class or pseudo-element '-webkit-input-placeholder'. Ruleset ignored due to bad selector. library.css:12:217598
Unknown pseudo-class or pseudo-element '-ms-input-placeholder'. Ruleset ignored due to bad selector. library.css:12:217790
Unknown property 'user-select'. Declaration dropped. library.css:12:232621
Unknown property '-moz-box-shadow'. Declaration dropped. library.css:12:237459
Unknown property '-moz-border-radius'. Declaration dropped. library.css:12:237575
Error in parsing value for 'background'. Declaration dropped. library.css:12:243709
Error in parsing value for 'background'. Declaration dropped. library.css:12:243814
Error in parsing value for 'background'. Declaration dropped. library.css:12:243877
Expected 'none', URL, or filter function but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. library.css:12:243993
Error in parsing value for 'background'. Declaration dropped. library.css:12:244184
Error in parsing value for 'background'. Declaration dropped. library.css:12:244289
Error in parsing value for 'background'. Declaration dropped. library.css:12:244352
Expected 'none', URL, or filter function but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. library.css:12:244468
Error in parsing value for 'background'. Declaration dropped. library.css:12:244659
Error in parsing value for 'background'. Declaration dropped. library.css:12:244764
Error in parsing value for 'background'. Declaration dropped. library.css:12:244827
Expected 'none', URL, or filter function but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. library.css:12:244943
Error in parsing value for 'background'. Declaration dropped. library.css:12:245134
Error in parsing value for 'background'. Declaration dropped. library.css:12:245239
Error in parsing value for 'background'. Declaration dropped. library.css:12:245302
Expected 'none', URL, or filter function but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. library.css:12:245418
Unknown property 'speak'. Declaration dropped. library.css:12:246967
Unknown property 'transfrom-origin'. Declaration dropped. library.css:12:247374
Error in parsing value for 'background'. Declaration dropped. library.css:12:250304
Error in parsing value for 'background'. Declaration dropped. library.css:12:250409
Error in parsing value for 'background'. Declaration dropped. library.css:12:250565
Error in parsing value for 'background'. Declaration dropped. library.css:12:250670
Unknown pseudo-class or pseudo-element '-webkit-search-cancel-button'. Ruleset ignored due to bad selector. library.css:12:253014
Unknown pseudo-class or pseudo-element '-ms-clear'. Ruleset ignored due to bad selector. library.css:12:253090
Unknown property 'speak'. Declaration dropped. library.css:12:253625
Unknown pseudo-class or pseudo-element '-webkit-input-placeholder'. Ruleset ignored due to bad selector. library.css:12:254104
Unknown pseudo-class or pseudo-element '-ms-input-placeholder'. Ruleset ignored due to bad selector. library.css:12:254190
Unknown property 'speak'. Declaration dropped. library.css:12:258844
Unknown property '-moz-box-shadow'. Declaration dropped. library.css:12:266442
Unknown property '-moz-background-clip'. Declaration dropped. library.css:12:266627
Unknown property 'user-select'. Declaration dropped. library.css:12:277855
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vinay,
I am getting the same error.
Could you please share how you went about resolving this issue.
<title>Error 500 unknown protocol: sap</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /Table/proxy/sap/opu/odata/SAP/TEST_SRV/$metadata. Reason:
<pre> unknown protocol: sap</pre></p><h3>Caused by:</h3><pre>java.net.MalformedURLException: unknown protocol: sap
at java.net.URL.<init>(Unknown Source)
Thanks,
Neethu
Hi Vinay,
var sUrl = "proxy/http/sap02:8000/sap/opu/odata/SAP/ZSL_EPM_DEMO_SRV/SalesOrderSet";
1. No need to use http here. proxy returns http://<HOST>:<PORT> information to you.
If you used proxy/http.....
It will return http twice.
2. Under web.xml
<servlet-mapping>
<servlet-name>SimpleProxyServlet</servlet-name>
<url-pattern>/proxy/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>com.sap.ui5.proxy.REMOTE_LOCATION</param-name>
<param-value>http://YOUR_DOMIN : PORT</param-value>
</context-param>
3. Use: Omodel Classes, Because It is Server side model. JSON and XML models are client side model.
var oModel = sap.ui.model.odata.ODataModel(sUrl);
Thanks,
Karthik A
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Karthik,
changes had been done as required but getting below error.
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://sap02:8000/sap/opu/odata/SAP/ZSL_EPM_DEMO_SRV/$metadata. (Reason: CORS header 'Access-Control-Allow-Origin' missing). <unknown>
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://sap02:8000/sap/opu/odata/SAP/ZSL_EPM_DEMO_SRV/$metadata. (Reason: CORS request failed).
thanks for your input.
thanks Karthik for your input getting below error
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://sap02:8000/sap/opu/odata/SAP/ZSL_EPM_DEMO_SRV/$metadata. (Reason: CORS header 'Access-Control-Allow-Origin' missing). <unknown>
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://sap02:8000/sap/opu/odata/SAP/ZSL_EPM_DEMO_SRV/$metadata. (Reason: CORS request failed).
Hi Vinay,
oDataCreateInspLot.setHeaders({
"X-Requested-With" : "XMLHttpRequest",
"Content-Type" : "application/json",
"X-CSRF-Token" : "Fetch",
"DataServiceVersion" : "2.0"
});
Set this Header to OModel.
add this header too: 'Access-Control-Allow-Origin: *'
Link: http://stackoverflow.com/questions/7564832/how-to-bypass-access-control-allow-origin
Thanks,
Karthik A
thanks dhananjay for your help but still condition is same . i had replace my code same as you given. I am not able to fingureout what is the problem
GET
XHR
http://localhost:62045/demotable/proxy/http/sap02:8000/sap/opu/odata/SAP/ZSL_EPM_DEMO_SRV/$metadata [HTTP/1.1 500 Server Error 4ms]
GET
XHR
http://localhost:62045/demotable/proxy/http/sap02:8000/sap/opu/odata/SAP/ZSL_EPM_DEMO_SRV/$metadata [HTTP/1.1 500 Server Error 4ms]
uncaught exception: [object Object]
var oId = new sap.m.Text({text: "{SoId}"}); //Entity Name
var fname = new sap.m.Text({text: "{GrossAmount}"}); //Entity Name
var lname = new sap.m.Text({text: "{NetAmount}"}); //Entity Name
var oRow = new sap.m.ColumnListItem();
oRow.addCell(oId).addCell(fname).addCell(lname);
oTable.bindItems("/SalesOrderSet", oRow);
var sUrl = "proxy/http/sap02:8000/sap/opu/odata/SAP/ZSL_EPM_DEMO_SRV/"; |
// var oModel = sap.ui.model.json.JSONModel(sUrl,false,"HBTABAP","awtrans");
var oModel = sap.ui.model.odata.ODataModel(sUrl);//,false,"HBTABAP","awtrans"); | ||
sap.ui.getCore().setModel(oModel); |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi dhananjay,
which item?. i can able to see data in browser while testing odata service.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vinay,
Check out this working code.
Replace other parameter according to your need.
Code in view.(In Section Create content)
var oTable = new sap.m.Table("idEmployee", {
inset : true,
headerText : "List of Employees", \\Enter your title
headerDesign : sap.m.ListHeaderDesign.Standard,
mode : sap.m.ListMode.None,
includeItemInSelection : false
});
var col1 = new sap.m.Column("col1", {
header : new sap.m.Label({
text : "Employee ID" //Name of first column
})
});
oTable.addColumn(col1);
var col2 = new sap.m.Column("col2", {
header : new sap.m.Label({
text : "First Name" //Name of second column
})
});
oTable.addColumn(col2);
var col3 = new sap.m.Column("col3", {
header : new sap.m.Label({
text : "Last Name" //Name of third column
})
});
oTable.addColumn(col3);
//Prepare data for list item
var oId = new sap.m.Text({text: "{Empno}"}); //Entity Name
var fname = new sap.m.Text({text: "{Fname}"}); //Entity Name
var lname = new sap.m.Text({text: "{Lname}"}); //Entity Name
var oRow = new sap.m.ColumnListItem();
oRow.addCell(oId).addCell(fname).addCell(lname);
oTable.bindItems("/testSet", oRow); //Here Enter entitySet name
return oTable;
Code in controller.
onInit: function() {
var oModel = sap.ui.model.odata.ODataModel("proxy/http/URL:PORT/sap/opu/odata/sap/ZDC_TEST_SRV/");
sap.ui.getCore().setModel(oModel);
},
use JSONModel to load OData is one of the 7 SAPUI5 sins
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Maksim,
Thanks for your soon reply,
I had used below code to bind odata, Is any more change is required in more.
var sUrl = "proxy/http/sap02:8000/sap/opu/odata/SAP/ZSL_EPM_DEMO_SRV/SalesOrderSet"; |
var oModel = sap.ui.model.json.JSONModel(sUrl,false,"","");
I am getting error.
XHR
[HTTP/1.1 403 Forbidden 47ms]
2015-09-23 10:27:22 The following problem occurred: error - ,403,Forbidden sap-ui-core.js:80:8865
z() sap-ui-core.js:80
A/this.fatal() sap-ui-core.js:80
c.prototype.loadData/<.error() JSONModel.js:6
w/<() sap-ui-core.js:144
Q.Callbacks/t() sap-ui-core.js:27
Q.Callb
is the servlet configured correctly in web.xml
like
<servlet>
<servlet-name>SimpleProxyServlet</servlet-name>
<servlet-class>com.sap.ui5.proxy.SimpleProxyServlet</servlet-class>
<init-param>
<param-name>com.sap.ui5.proxy.REMOTE_LOCATION</param-name>
<param-value>http://<HOST>:<PORT>/</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>SimpleProxyServlet</servlet-name>
<url-pattern>/proxy/*</url-pattern>
</servlet-mapping>
hi,
Same error after changing as per you suggest.
GET
XHR
[HTTP/1.1 403 Forbidden 15ms]
2015-09-23 11:00:35 The following problem occurred: error - ,403,Forbidden
hi,
After restart below error
GET
XHR
http://localhost:58186/demotable/proxy/http/sap02.com:8000/sap/opu/odata/SAP/ZSL_EPM_DEMO_SRV/SalesO... [HTTP/1.1 500 Server Error 0ms]
2015-09-23 11:14:37 The following problem occurred: error - <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 500 Server Error</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /demotable/proxy/http/sap02.com:8000/sap/opu/odata/SAP/ZSL_EPM_DEMO_SRV/SalesOrderSet. Reason:
<pre> Server Error</pre></p><h3>Caused by:</h3><pre>java.net.MalformedURLException: unknown protocol: sap02.com
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at com.sap.ui5.proxy.SimpleProxyServlet.service(SimpleProxyServlet.java:184)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:501)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.
Hi,
Use like this and check if this is working.
var sUrl = "proxy/http/sap02:8000/sap/opu/odata/SAP/ZSL_EPM_DEMO_SRV/";\\ remove entityset name var oModel = sap.ui.model.odata.ODataModel(sUrl); Bind your entityset to your table. First paste this link in browser and check if you are getting your data or metadata. http://sap02:8000/sap/opu/odata/SAP/ZSL_EPM_DEMO_SRV/SalesOrderSet If you are not getting data from this URL then error is in backend system. Go to this transaction in your backend, /o/IWFND/ERROR_LOG and check if any error is populating there. Best Regards Dhananjay |
i restart and run the application still same error.
GET
XHR
http://localhost:58487/demotable/proxy/sap/opu/odata/SAP/ZSL_EPM_DEMO_SRV/SalesOrderSet [HTTP/1.1 500 Server Error 4ms]
2015-09-23 11:43:59 The following problem occurred: error - <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 500 Server Error</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /demotable/proxy/sap/opu/odata/SAP/ZSL_EPM_DEMO_SRV/SalesOrderSet. Reason:
<pre> Server Error</pre></p><h3>Caused by:</h3><pre>java.net.MalformedURLException: unknown protocol: sap02.hcc-india.com
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at com.sap.ui5.proxy.SimpleProxyServlet.service(SimpleProxyServlet.java:184)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)
Hi Dhananjay,
Thanks for you suggestion.
I had test this by passing url at browser only username and password it ask when is pass user name and password below output i recived
SalesOrderSet
SalesOrderSet('28000001')
23 September 2015 08:50
SalesOrderSet('25000000')
23 September 2015 08:50
SalesOrderSet('21000001')
23 September 2015 08:50
SalesOrderSet('24000003')
23 September 2015 08:50
SalesOrderSet('10000004')
23 September 2015 08:50
SalesOrderSet('22000000')
23 September 2015 08:50
Below url i passed to browser
http://sap02:8000/sap/opu/odata/SAP/ZSL_EPM_DEMO_SRV/
below output show
<app:service xml:lang="en" xml:base="http://sap02.com:8000/sap/opu/odata/SAP/ZSL_EPM_DEMO_SRV/"><app:workspace><atom:title type="text">Data</atom:title><app:collection sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:pageable="false" sap:content-version="1" href="OrderItemsSet"><atom:title type="text">OrderItemsSet</atom:title><sap:member-title>OrderItems</sap:member-title></app:collection><app:collection sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:pageable="false" sap:content-version="1" href="SalesOrderSet"><atom:title type="text">SalesOrderSet</atom:title><sap:member-title>SalesOrder</sap:member-title></app:collection></app:workspace><atom:link rel="self" href="http://sap02:8000/sap/opu/odata/SAP/ZSL_EPM_DEMO_SRV/"/><atom:link rel="latest-version" href="http://sap02:8000/sap/opu/odata/SAP/ZSL_EPM_DEMO_SRV/"/></app:service>
How to bind entitySet with table ? . But when i test my application by using Northwind.srv it was working. than i change odata service than i got this error.
2015-09-23 12:01:37 The following problem occurred: error - <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 500 Server Error</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /demotable/proxy/http/sap02.hcc-india.com:8000/sap/opu/odata/SAP/ZSL_EPM_DEMO_SRV. Reason:
<pre> Server Error</pre></p><h3>Caused by:</h3><pre>java.net.MalformedURLException: unknown protocol:
yes the told changes had been but below error show
GET
XHR
http://localhost:58487/demotable/proxy/http/sap02:8000/sap/opu/odata/SAP/ZSL_EPM_DEMO_SRV/$metadata
[HTTP/1.1 500 Server Error 4ms]
uncaught exception: [object Object]
Yes told changes had been but still below error is coming.
GET
XHR
http://localhost:58487/demotable/proxy/http/sap02:8000/sap/opu/odata/SAP/ZSL_EPM_DEMO_SRV/$metadata
[HTTP/1.1 500 Server Error 4ms]
uncaught exception: [object Object]
in Controller.js
onInit: function() {
var sUrl = "proxy/http/sap02:8000/sap/opu/odata/SAP/ZSL_EPM_DEMO_SRV";;
var oModel = sap.ui.model.odata.ODataModel(sUrl);
sap.ui.getCore().setModel(oModel);
},
in view.js
createContent : function(oController) {
var oTable = new sap.m.Table("idPrdList",{
inset : true ,
headerText : "List of Product",
headerDesign : sap.m.ListHeaderDesign.Standard,
mode : sap.m.ListMode.None,
includeItemInSelection : false});
var col1 = new sap.m.Column("col1",{header: new sap.m.Label({text:"Product Name"})});
oTable.addColumn(col1);
var col2 = new sap.m.Column("col2",{header: new sap.m.Label({text:"Decription"})});
oTable.addColumn(col2);
var col3 = new sap.m.Column("col3",{header: new sap.m.Label({text:"Price"})});
oTable.addColumn(col3);
var colItems = new sap.m.ColumnListItem("colItems",{type:"Active"});
oTable.bindAggregation("items","/value",colItems);
// var txtNAME = new sap.m.Text("txtNAME",{text:"{ProductID}"});
var txtNAME = new sap.m.Text("txtNAME",{text:"{SoId}"});
colItems.addCell(txtNAME);
// var txtNAME2 = new sap.m.Text("txtNAME2",{text:"{ProductName}"});
var txtNAME2 = new sap.m.Text("txtNAME2",{text:"{GrossAmount}"});
colItems.addCell(txtNAME2);
// var txtNAME3 = new sap.m.Text("txtNAME3",{text:"{UnitsInStock}"});
var txtNAME3 = new sap.m.Text("txtNAME3",{text:"{NetAmount}"});
colItems.addCell(txtNAME3);
return new sap.m.Page({
title: "Test First App",
content: [
oTable
]
});
}
in .html
<script src="resources/sap-ui-core.js" id="sap-ui-bootstrap"
data-sap-ui-libs="sap.m" data-sap-ui-theme="sap_bluecrystal"
data-sap-ui-xx-bindingSyntax="complex">
</script>
<!-- only load the mobile lib "sap.m" and the "sap_bluecrystal" theme -->
<script>
sap.ui.localResources("demotable");
var app = new sap.m.App({initialPage:"iddemoTable1"});
var page = sap.ui.view({id:"iddemoTable1",
viewName:"demotable.demoTable",
type:sap.ui.core.mvc.ViewType.JS});
app.addPage(page);
app.placeAt("content");
</script>
Hi Dhananjay,
Please help for my issue for Access-Control-Allow-Origin i had see ur all vedio and follow same step still i m getting same error access-control-allow-orgin issue . help me if any thing is missing or missing in minimum system requirement.
Your Input will be really helpful for completing the flow.
User | Count |
---|---|
68 | |
9 | |
8 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.