Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Can't access SAP sample gateway services data

Hello Everybody,

I am trying to connect my UI5 application with SAP sample oData Gateway Services. But unfortunately it doesn't Show any data in the table of my UI5 application. oData Gateway URL and application code snippets are the following.

Sample Gateway Services: https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZGWSAMPLE_SRV/$metadata

oData Entity values:

-<EntityType sap:content-version="1" Name="BusinessPartner">

-<Key>

<PropertyRef Name="BusinessPartnerID"/>

</Key>

<Property Name="BusinessPartnerID" sap:updatable="false" sap:label="GeschPartnID" MaxLength="10" Nullable="false" Type="Edm.String" sap:creatable="false"/>

<Property Name="BpRole" sap:label="GeschPartnRolle" MaxLength="3" Type="Edm.String" sap:filterable="false"/>

<Property Name="EmailAddress" sap:label="E-Mail-Adresse" MaxLength="255" Type="Edm.String" sap:semantics="email" sap:filterable="false"/>

<Property Name="CompanyName" sap:label="Firmenname" MaxLength="80" Type="Edm.String"/>

Application code snippets:

createContent : function(oController) {

 

  var oModel = new sap.ui.model.odata.ODataModel("https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZGWSAMPLE_SRV");

  sap.ui.getCore().setModel(oModel);

  var oTable = new sap.ui.table.Table({

  editable: false

  });

  oTable.addColumn(new sap.ui.table.Column({

  label: new sap.ui.commons.Label({text: "ID"}),

  template: new sap.ui.commons.TextField().bindProperty("value", "BusinessPartnerID"),

  sortProperty: "BusinessPartnerID"

  }));

  

  oTable.addColumn(new sap.ui.table.Column({

  label: new sap.ui.commons.Label({text: "Name"}),

  template: new sap.ui.commons.TextField().bindProperty("value", "CompanyName"),

  sortProperty: "CompanyName"

  }));

  

  oTable.addColumn(new sap.ui.table.Column({

  label: new sap.ui.commons.Label({text: "E-mail"}),

  template: new sap.ui.commons.TextField().bindProperty("value", "EmailAddress"),

  sortProperty: "EmailAddress"

  }));

  

     oTable.setModel(oModel);

     oTable.bindRows("/BusinessPartner");

     oTable.placeAt("content");

  }

Please point me out where is the problem.

Thank you very much.

Tags:
replied

I have solved the problem. Actually we have to add a prefix 'proxy' before oData URI string like.

"proxy/https/sapes1.sapdevcenter.com/sap/opu/odata/sap/ZCD204_EPM_DEMO_SRV"

If the application has to run on ABAP server then we can write a normal string like.

"https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZCD204_EPM_DEMO_SRV"

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question