Skip to Content
author's profile photo Former Member
Former Member

Table doesn't get filled using Visual Studio and gateway service

Hi,

Recently I have been "playing" a bit with sap ui5. I made a simple website where a table gets filled with data. I fill the table using a gateway service. When I run the code using SAP GUI, my table gets filled, so that works. But when I make the same website using Visual Studio 2012, the table is empty.

SAP GUI

printscreen 1


printscreen 2


printscreen 3 (result)


VISUAL STUDIO 2012

<!DOCTYPE html>    <head>    <meta http-equiv='X-UA-Compatible' content='IE=edge' />    <title>SAP UI5 BEHRINGER PRODUCT WEBSHOP</title>    <script id='sap-ui-bootstrap' type='text/javascript'        src= "/resources/sap-ui-core.js"        data-sap-ui-theme="sap_platinum"        data-sap-ui-libs='sap.ui.commons,sap.ui.ux3,sap.ui.table'>    </script>    <script type="text/javascript">        var oModel = new sap.ui.model.odata.ODataModel("http://scvwis0046.dcsc.be:8010/sap/opu/odata/sap/Z_RFM_BEHRINGER_CM_WR", false, 'wuytsr', '*password*');        sap.ui.getCore().setModel(oModel);        var ploegenTabel = new sap.ui.table.DataTable({            title: "Products",            width: "75%"        });        ploegenTabel.addColumn(new sap.ui.table.Column({            label: new sap.ui.commons.Label({ text: "Model" }),            template: new sap.ui.commons.TextField().bindProperty("value", "model"),            sortProperty: "model"        }));        ploegenTabel.addColumn(new sap.ui.table.Column({            label: new sap.ui.commons.Label({ text: "Description" }),            template: new sap.ui.commons.TextField().bindProperty("value", "description"),            sortProperty: "description"        }));        ploegenTabel.addColumn(new sap.ui.table.Column({            label: new sap.ui.commons.Label({ text: "price" }),            template: new sap.ui.commons.TextField().bindProperty("value", "price"),            sortProperty: "price"        }));        ploegenTabel.bindRows("z_rfm_behringer_wrCollection");        ploegenTabel.placeAt("appBody");</script></head><body class="sapUiBody" role="application"><h1>Test app Wuyts Robbe </h1><div id="appBody"></div></body>

Printscreen (Result)

As you can see, the table doesn't get filled when I use the same code in Visual Studio.

Is there someone who knows what I am doing wrong, or what is missing?

Thanks!

sapgui_part1.png (212.5 kB)
sapgui_part2.png (205.3 kB)
sapgui_part3.png (189.7 kB)
vs2012.png (152.2 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Oct 15, 2012 at 05:28 PM

    Maybe your browser doesn't accept "Cross Origin Requests"

    That is happening to me now.

    Try on Google Chrome

    (

    Open cmd.exe in administration mode and go to the folder which contents chrome app

    C:/Users.../chrome.exe --disable-web-security

    )

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 15, 2012 at 11:28 PM

    Hi Robbe,

    As @RAUL MIGUEL ROMERO GALINDO says, this could easily be a SOP issue. In the developer guide they mention this scenario

    https://sapui5.netweaver.ondemand.com/sdk/#docs/guide/TestingInEclipse.html

    They provide a Java proxy to get around this issue. You may need something similar, I notice you are trying to use 'localhost' and access the GW service from a different domain... this is very likely a SOP issue:

    https://developer.mozilla.org/en-US/docs/Same_origin_policy_for_JavaScript

    Hope this helps,

    Simon

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 16, 2012 at 11:44 AM

    Thanks Simon and Raul. I didn't open google chrome the correct way (I thought web security was disabled, but it wasn't...) Anyways, problem solved! 😊

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Raul Miguel Romero Galindo

      Hi,

      I have similar kind of problem. I have a code which is almost similar to screen
      shots posted above. When i use the same code in a html file in web project in
      visual studio 2012 i get an error "Unable to load the sapui/core.js file
      from server". But when i paste same code in a simple text file and
      save it with html extension it works fine and displays all data. Also, My
      system and net weaver system both are in same domain.

      I have tried disabling web security but still it doesn't work. Can any one help
      me for this?

      Thanks in advance,

      Regards,

      Sudha.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.