on 02-24-2014 3:57 PM
Hi
i created my SAPUI5 project. the first file is xsodataTest.xml which contain the current code:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>
<script src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"
id="sap-ui-bootstrap"
data-sap-ui-libs="sap.ui.commons,sap.ui.table"
data-sap-ui-theme="sap_bluecrystal">
</script>
<!-- add sap.ui.table,sap.ui.ux3 and/or other libraries to 'data-sap-ui-libs' if required -->
<script>
sap.ui.localResources("exercises_ui");
var view = sap.ui.view({id:"idxsodataTest", viewName:"exercises_ui.xsodataTest", type:sap.ui.core.mvc.ViewType.JS});
view.placeAt("content");
</script>
</head>
<body class="sapUiBody" role="application">
<div id="content" style="direction:ltr">dfgdfg</div>
</body>
</html>
The second file as xsodataTest.view.js which contain the current code:
sap.ui.jsview("exercises_ui.xsodataTest", {
/** Specifies the Controller belonging to this View.
* In the case that it is not implemented, or that "null" is returned, this View does not have a Controller.
* @memberOf exercises_ui.xsodataTest
*/
getControllerName : function() {
return "exercises_ui.xsodataTest";
},
/** Is initially called once after the Controller has been instantiated. It is the place where the UI is constructed.
* Since the Controller is given to this method, its event handlers can be attached right away.
* @memberOf exercises_ui.xsodataTest
*/
createContent : function(oController) {
var oLayout = new sap.ui.commons.layout.MatrixLayout({width:"100%"});
var oModel = new sap.ui.model.odata.ODataModel("192.168.10.119:8000/workshop/sessiona/00/MO_SalesData.xsodata", false);
var oControl;
this.oSHTable = new sap.ui.table.Table("soTable",{ visibleRowCount: 10, });
this.oSHTable.setTitle("SALES_ORDER_HEADERS");
//Table Column Definitions
oControl = new sap.ui.commons.TextView().bindProperty("text","Country");
this.oSHTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text: "Country"}), template: oControl, sortProperty: "Country", filterProperty: "Country", filterOperator: sap.ui.model.FilterOperator.EQ, flexible: true }));
oControl = new sap.ui.commons.TextView().bindProperty("text","CardCode");
this.oSHTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text: "CardCode"}), template: oControl, sortProperty: "CardCode", filterProperty: "CardCode" }));
oControl = new sap.ui.commons.TextView().bindProperty("text","CardName");
this.oSHTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text: "CardName"}), template: oControl, sortProperty: "CardName", filterProperty: "CardName", filterOperator: sap.ui.model.FilterOperator.Contains }));
oControl = new sap.ui.commons.TextView().bindText("DocNum",oController.numericFormatter);
oControl.setTextAlign("End");
this.oSHTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text: "DocNum"}), template: oControl, sortProperty: "DocNum", filterProperty: "DocNum", hAlign: sap.ui.commons.layout.HAlign.End}));
oControl = new sap.ui.commons.TextView().bindProperty("text","Quantity");
this.oSHTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text: "Quantity"}), template: oControl, sortProperty: "Quantity", filterProperty: "Quantity" }));
this.oSHTable.setModel(oModel);
var sort1 = new sap.ui.model.Sorter("Country", true);
this.oSHTable.bindRows({ path: "/SalesOrderHeader", parameters: {expand: "Country", select: "Country,CardCode,CardName,DocNum,Quantity"}, sorter: sort1 });
this.oSHTable.setTitle("Sales Orders");
oLayout.createRow(this.oSHTable);
return oLayout;
}
});
when i'm uploading MO_SalesData.xsodata in the browser it's present it content properly as can be seen in the attached picture.
but when i'm uploading xsodataTest.html webpage i can't see the MO_SalesData data and i have connection problem as can be seen in the attached printscreen too.
Please advice regarding my problem
Is it working now for you? if yes can you tell what have you done , it would be helpful..
Regards,
Krishna Tangudu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes it's works for me. in the xsodataTest.view file in the bind row i put the name of the view as appear in the xsodata file.
xsodataTest.view fiel:
oTable.bindRows("/MO_SALESDATA",sort1); |
xsodata file:
service namespace "workshop.services"{
"sap.moroccoanoil::MO_SALESDATA" as "MO_SALESDATA" key ("ItemCode","DocNum") ;
}
when i'm using the link "https://sapui5.hana.ondemand.com/resources/sap-ui-core.js" in xsodataTest.html as can be seen here:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>
<script src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"
id="sap-ui-bootstrap"
data-sap-ui-libs="sap.ui.commons,sap.ui.table"
data-sap-ui-theme="sap_bluecrystal">
</script>
<!-- add sap.ui.table,sap.ui.ux3 and/or other libraries to 'data-sap-ui-libs' if required -->
<script>
sap.ui.localResources("exercises_ui");
var view = sap.ui.view({id:"idxsodataTest", viewName:"exercises_ui.xsodataTest", type:sap.ui.core.mvc.ViewType.JS});
view.placeAt("content");
</script>
</head>
<body class="sapUiBody" role="application">
<div id="content" style="direction:ltr"></div>
</body>
</html>
the response i got in the html page approve that it succed to recognize XS engine so i i think that we should see results in the webpage but we don't......
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So you need to troubleshoot this like any other app. Here are some pointers.
- You can't have cross-domain loading for SAPUI5 - get it all in one domain and fix the import problem
- Check the xsodata returns data
- Check this matches exactly your table definition
- If in doubt, break the problem down into a much simpler page and build it back up
Hope this helps.
John
1. i don't think that the issue of 'cross-domain loading for SAPUI5' creating the problem. you can see in the previous print screen that it succed to connect to the hana server as require.
2. My example was the same as was seen in the course 'Introduction to SAP HANA Software Developtment' so it should work....the xsodata return data as require .i check it seperatly.
i don't have any reasonable answer to it problem....
Hi Why are u using the online link for UI?
"https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"
Is there no internal installation done? i guess because you are using external library over the net it is unable to communicate with XS engine and hence you are only getting the panel and not the data.
Do you use the internal installation SRC tag and check once.
Regards,
Krishna Tangudu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm Using this external library because i deal with problems when i'm trying to upload the data from the internal library ("/sap/ui5/1/resources/sap-ui-core.js"). when i'm using this library i get message error. as you can see here. the advice i got from other forum discussion was to use "https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"
Got it, i don think the external server is able to communicate to your XS server and hence you are unable to get any data. I guess this to be reason.
Please try to reinstall UI5 and check if you can resolve the issue.
One more thing,
We increased the size of global_allocation_limit and give 32000 and "restart" your hana database server and check if you are able to find the sap-core-ui.js file . This is how i solved that issue and it worked for me.
Regards,
Krishna Tangudu
Ho got it, i was under impression that file itself didn't exist, the workaround i suggested is for getting this file into the library.
Now you are presented with a different error altogether. As far as only when you would be able to utilize the internal library you should be able to communicate to XS.
These are my 2 cents, and i will be waiting along with you for the resolution of this discussion.
Regards,
Krishna Tangudu
Yes ofcourse . the last version of my xsodataTest.html is:
sap.ui.jsview("exercises_ui.xsodataTest", {
/** Specifies the Controller belonging to this View.
* In the case that it is not implemented, or that "null" is returned, this View does not have a Controller.
* @memberOf exercises_ui.xsodataTest
*/
getControllerName : function() {
return "exercises_ui.xsodataTest";
},
/** Is initially called once after the Controller has been instantiated. It is the place where the UI is constructed.
* Since the Controller is given to this method, its event handlers can be attached right away.
* @memberOf exercises_ui.xsodataTest
*/
createContent : function(oController) {
var oModel=new sap.ui.model.odata.ODataModel("/workshop/sessiona/00/MO_SalesData.xsodata",false);
var arrayHeader= new Array();
var oControl;
oTable= new sap.ui.table.Table("Test",{tableId:"tableID",visibleRowCount:10});
oTable.setTitle("Sales Order");
//Table Column Defination
oControl=new sap.ui.commons.TextField().bindProperty("value","Country");
oTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text:"Country"}),template: oControl, sortProperty: "Country", filterProperty: "Country"}));
oControl=new sap.ui.commons.TextField().bindProperty("value","CountryCode");
oTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text:"CountryCode"}),template: oControl, sortProperty: "CountryCode", filterProperty: "CountryCode"}));
oControl=new sap.ui.commons.TextField().bindProperty("value","CardCode");
oTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text:"CardCode"}),template: oControl, sortProperty: "CardCode", filterProperty: "CardCode"}));
oControl=new sap.ui.commons.TextField().bindProperty("value","CardName");
oTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text:"CardName"}),template: oControl, sortProperty: "CardName", filterProperty: "CardName"}));
oControl=new sap.ui.commons.TextField().bindProperty("value","DocDate");
oTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text:"DocDate"}),template: oControl, sortProperty: "DocDate", filterProperty: "DocDate"}));
oControl=new sap.ui.commons.TextField().bindProperty("value","DocNum");
oTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text:"DocNum"}),template: oControl, sortProperty: "DocNum", filterProperty: "DocNum"}));
oControl=new sap.ui.commons.TextField().bindProperty("value","ItemCode");
oTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text:"ItemCode"}),template: oControl, sortProperty: "ItemCode", filterProperty: "ItemCode"}));
oControl=new sap.ui.commons.TextField().bindProperty("value","FrgnName");
oTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text:"FrgnName"}),template: oControl, sortProperty: "FrgnName", filterProperty: "FrgnName"}));
oControl=new sap.ui.commons.TextField().bindProperty("value","Quantity");
oTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text:"Quantity"}),template: oControl, sortProperty: "Quantity", filterProperty: "Quantity"}));
oControl=new sap.ui.commons.TextField().bindProperty("value","PricePerUnit");
oTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text:"PricePerUnit"}),template: oControl, sortProperty: "PricePerUnit", filterProperty: "PricePerUnit"}));
oTable.setModel(oModel);
//Create Sorter and Bind to the Sales Order Entity
var sort1= new sap.ui.model.Sorter("Country");
oTable.bindRows("Sales Order",sort1);
var iNumberOfRows=oTable.getBinding("rows").iLength;
oTable.setTitle("Sales Order"+"("+iNumberOfRows+")");
return oTable;
});
the file was activate succesfully and i still have the issue for empty result when i'm using the link "https://sapui5.hana.ondemand.com/resources/sap-ui-core.js" or message error when i'm enter the path /sap/ui5/1/resources/sap-ui-core.js as mention before...
Hi,
Try defining OData Model without Server address and check:
var oModel = new sap.ui.model.odata.ODataModel("/workshop/sessiona/00/MO_SalesData.xsodata", false);
Regards,
Vivek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
i tried to run current xsodata.view.js file:
sap.ui.jsview("exercises_ui.xsodataTest", {
/** Specifies the Controller belonging to this View.
* In the case that it is not implemented, or that "null" is returned, this View does not have a Controller.
* @memberOf exercises_ui.xsodataTest
*/
getControllerName : function() {
return "exercises_ui.xsodataTest";
},
/** Is initially called once after the Controller has been instantiated. It is the place where the UI is constructed.
* Since the Controller is given to this method, its event handlers can be attached right away.
* @memberOf exercises_ui.xsodataTest
*/
createContent : function(oController) {
var oModel=new sap.ui.model.odata.ODataModel("/workshop/sessiona/00/MO_SalesData.xsodata/",false);
var arrayHeader= new Array();
var oControl;
oTable= new sap.ui.table.Table("Test",{tableId:"tableID",visibleRowCount:10});
oTable.setTitle("Sales Order");
//Table Column Defination
oControl=new sap.ui.commons.TextField().bindProperty("value","Country");
oTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text:"Country"}),template: oControl, sortProperty: "Country", filterProperty: "Country"}));
oControl=new sap.ui.commons.TextField().bindProperty("value","CountryCode");
oTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text:"CountryCode"}),template: oControl, sortProperty: "CountryCode", filterProperty: "CountryCode"}));
oControl=new sap.ui.commons.TextField().bindProperty("value","CardCode");
oTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text:"CardCode"}),template: oControl, sortProperty: "CardCode", filterProperty: "CardCode"}));
oControl=new sap.ui.commons.TextField().bindProperty("value","CardName");
oTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text:"CardName"}),template: oControl, sortProperty: "CardName", filterProperty: "CardName"}));
oControl=new sap.ui.commons.TextField().bindProperty("value","DocDate");
oTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text:"DocDate"}),template: oControl, sortProperty: "DocDate", filterProperty: "DocDate"}));
oControl=new sap.ui.commons.TextField().bindProperty("value","DocNum");
oTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text:"DocNum"}),template: oControl, sortProperty: "DocNum", filterProperty: "DocNum"}));
oControl=new sap.ui.commons.TextField().bindProperty("value","DocNum");
oTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text:"DocNum"}),template: oControl, sortProperty: "DocNum", filterProperty: "DocNum"}));
oControl=new sap.ui.commons.TextField().bindProperty("value","ItemCode");
oTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text:"ItemCode"}),template: oControl, sortProperty: "ItemCode", filterProperty: "ItemCode"}));
oControl=new sap.ui.commons.TextField().bindProperty("value","FrgnName");
oTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text:"FrgnName"}),template: oControl, sortProperty: "FrgnName", filterProperty: "FrgnName"}));
oControl=new sap.ui.commons.TextField().bindProperty("value","Quantity");
oTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text:"Quantity"}),template: oControl, sortProperty: "Quantity", filterProperty: "Quantity"}));
oControl=new sap.ui.commons.TextField().bindProperty("value","PricePerUnit");
oTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text:"PricePerUnit"}),template: oControl, sortProperty: "PricePerUnit", filterProperty: "PricePerUnit"}));
oControl= new sap.ui.commons.Link().bindProperty("text","WebAddress");
oControl.bindProperty("href","WebAddress");
oControl.setTarget("_blank");
oTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text:"Web Address"}),template: oControl, sortProperty: "WebAddress", filterProperty: "WebAddress"}));
oTable.setModel(oModel);
//Create Sorter and Bind to the Sales Order Entity
//var sort1= new sap.ui.model.Sorter("Country");
//oTable.bindRows("/Sales Order",sort1);
//var iNumberOfRows=oTable.getBinding("rows").iLength;
//oTable.setTitle("Sales Order"+"("+iNumberOfRows+")");
oTable.setTitle("Sales Order");
return oTable;
}
});
But still i'm getting empty results eventhough i don't see any messae error as you can see in attached picture2.png. wy i'm getting empty result?
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
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.