Hi All,
I have done handshake between rest api and sap backend with the following code and data is coming on UI backend but not on UI. Please suggest.
First view
- sap.ui.jsview("uitest2.first", {
getControllerName : function() {
return"uitest2.first";
},
createContent : function(oController) {
var Dealer = new sap.m.HBox({
items:[
new sap.m.Label({
text: 'Dealer Code'
}),
new sap.m.Input("CUSTOMER",{
type: sap.m.InputType.Text,
placeholder: 'Enter Dealer code...'
}),
]
});
var button = new sap.m.Button({
text: "Submit",
press: function(oEvent) {
var oParameters = {
"CUSTOMER" : sap.ui.getCore().getElementById('CUSTOMER').getValue(),
};
var oModel = new sap.ui.model.json.JSONModel();
oModel.loadData("http://vpides.abcdef.in:8000/sap/bc/zrest_customer?sap-client=800/", oParameters, true, 'GET');
app = sap.ui.getCore().byId("myApp");
app.to("idsecond1");//,
},
});
returnnew sap.m.Page({
title: "Sales Dealer Info",
content: [ Dealer,button
]
});
}
});
Second view
- sap.ui.jsview("uitest2.second", {
getControllerName : function() {
return"uitest2.second";
},
createContent : function(oController) {
var table = new sap.m.Table({
headerText: "Dealer data",
columns: [
new sap.m.Column({
header: new sap.m.Label({text: "Name"})
}),
new sap.m.Column({
header: new sap.m.Label({text: "City"}),
}),
new sap.m.Column({
header: new sap.m.Label({text: "country"}),
}),
new sap.m.Column({
header: new sap.m.Label({text: "ISO"}),
}),
new sap.m.Column({
header: new sap.m.Label({text: "Streer"}),
}),
new sap.m.Column({
header: new sap.m.Label({text: "Post code"}),
}),
new sap.m.Column({
header: new sap.m.Label({text: "Telephone"}),
}),
new sap.m.Column({
header: new sap.m.Label({text: "Email"}),
})
],
items: {
path: "/KEY",
template: new sap.m.ColumnListItem({
cells: [
new sap.m.Text({ //new sap.m.ObjectIdentifier
text: "{NAME}"
}),
new sap.m.Text({
text: "{CITY}"
}),
new sap.m.Text({
text: "{COUNTRY}"
}),
new sap.m.Text({
text: "{COUNTRYISO}"
}),
new sap.m.Text({
text: "{STREET}"
}),
new sap.m.Text({
text: "{PST_CODE}"
}),
new sap.m.Text({
text: "{TELEPHONE}"
}),
new sap.m.Text({
text: "{EMAIL}"
})
],
})
}
});
returnnew sap.m.Page({
title: "Dealer Info",
showNavButton: true,
navButtonTap:function(){
app = sap.ui.getCore().byId("myApp");
app.to("idfirst1");
} ,
content: [ table
]
});
}
});
Second controller:
- sap.ui.controller("uitest2.second", {
onInit: function() {
var oModel = new sap.ui.model.json.JSONModel();
var url = ‘'http://vpides.abcdef.in:8000/sap/bc/zrest_customer?sap-client=800/';
$.ajax({
url : url,
type:'GET',
success: function (data, textStatus, jqXHR) {
data = JSON.parse(data);
console.log(data);
oModel.setData(data);
},
});
},
});
data in UI Backend
Thanks
Shubhanshu