on 01-08-2015 11:01 AM
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.
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.
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"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Because you need to bind the Entity Collection.
Check https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZGWSAMPLE_SRV/BusinessPartnerCollection
below line should be,
oTable.bindRows("/BusinessPartnerCollection");
Regards,
Chandra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.