on 12-24-2012 8:32 AM
Hello!
I'm trying one example with Sales Order table and SAP UI5.
I have an "index.html" file, like that:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='X-UI-Compatible' content='IE=edge'>
<title>SAPUI demo</title>
<script id="sap-ui-bootstrap"
src="../sapui5/resources/sap-ui-core.js"
data-sap-ui-theme="sap_platinum"
data-sap-ui-libs="sap.ui.commons, sap.ui.table"></script>
<script src="app.js"></script>
</head>
<body class="sapUiBody">
<img src="saplogo.jpg">
<div id="salesorders"></div>
<div id="lineitems"></div>
</body>
</html>
And an "app.js" js file:
var ODataModel = sap.ui.model.odata.ODataModel,
TextField = sap.ui.commons.TextField,
TextView = sap.ui.commons.TextView,
Label = sap.ui.commons.Label,
DataTable = sap.ui.table.DataTable,
Column = sap.ui.table.Column,
SelectionMode = sap.ui.table.SelectionMode;
// SAP Gateway SalesOrderService as an Odata model
var salesOrderService =
"https://gw.esworkplace.sap.com/sap/opu/sdata/IWFND/SALESORDER",
// username and passwd for SDN
username = "GW@ESW",
password = "ESW4GW",
asJson = false,
salesOrderModel = new ODataModel(salesOrderService, asJson, username, password),
salesOrderCollection = "SalesOrderCollection";
var salesOrders = new DataTable({
title: "Sales Orders",
width: "100%",
visibleRowCount: 5,
selectionMode: SelectionMode.Single,
editable: false
});
var salesOrderColumns = [
{ header: "Sales Order ID", value: "{SalesOrderID}", width: '100px' },
{ header: "Customer Name", value: "{CustomerName}", width: '50%' },
{ header: "Amount", value: "{TotalSum}", width: '50%' }
];
// create the columns
salesOrderColumns.forEach(function (column) {
var label = new Label({text: column.header }),
template = new TextView({ text: column.value }),
column = new Column({
label: label,
template: template,
width: column.width
});
salesOrders.addColumn(column);
});
// connect the data table to the Sales Order service
salesOrders.setModel(salesOrderModel);
// An OData request will return sales orders
salesOrders.bindRows(salesOrderCollection);
//Put table in the DOM
salesOrders.placeAt("salesorders");
//Create the line items datatable
var lineItems = new DataTable({
title: "Line items",
width: "100%",
visibleRowCount: 10,
selectionMode: SelectionMode.Single,
editable: false
});
lineItemCoumns = [
{ header: "Line item #", value: "{SalesOrderItem}", width: '100px' },
{ header: "Product Name", value: "{ProductName}", width: '50%' },
{ header: "Amount", value: "{NetSum}", width: '50%' }
]
lineItemCoumns.forEach(function (column) {
var label = new Label({ text: column.header }),
template = new TextView({ text: column.value }),
column = new Column({
label: label,
template: template,
width: column.width
});
lineItems.addColumn(column);
});
lineItems.setModel(salesOrderModel);
lineItems.placeAt("lineitems");
I've disabled web security with "--disable-web-security" in chrome.
But I have not retrieved any information... And there are no errors in console...
Please, help me!
P.S. Sorry for my english.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Elias,
Use a forward slash in front of collection name
salesOrderCollection = "/SalesOrderCollection";
find attached file with changes
services could be used form below message too
http://scn.sap.com/docs/DOC-31221
service https://gw.esworkplace.sap.com/sap/opu/sdata/IWFND/SALESORDER seems to be down when pasted on the browser no response is obtained.
Thanks and Regards, Venkatesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I too have the same problem.............but i am not using Netweaver .....I am Calling an Jason data from a free sales order webservice
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.