cancel
Showing results for 
Search instead for 
Did you mean: 

SAP UI5 Sales Order - no data

Former Member
0 Kudos

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...

http://gyazo.com/da1ab9f8d0b8710ae0bb2b4a3bcbd4fe.png?1356337873

Please, help me!

P.S. Sorry for my english.

Accepted Solutions (0)

Answers (3)

Answers (3)

0 Kudos

Hi Elias and Vishnu,

Check out the below link and change some code as they said then you will get it,

Thanks,

Ranjani Sekar

former_member91307
Contributor
0 Kudos

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

Former Member
0 Kudos

I too have the same problem.............but i am not using Netweaver .....I am Calling an Jason data from a free sales order webservice