cancel
Showing results for 
Search instead for 
Did you mean: 

Fetching data from ODATA model to SAPUI5 webpage with different controls and

Former Member
0 Kudos

Hi SAPUI5/ODATA Experts,

I have a SAPUI5 page developed in view.js and controller.js with having mutliple combobox controls in the SPAUI5 page.

Can anyone suggest,on how to get data for that particular combobox using odata model,i don't want any JSON included in between and i don't want to use view.xml in SAPUI5.

Please help me with some sample links or codes

Please help me soon !!

Thanks,
Jay

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi Efam/SAPUI5 Experts,

Can please help me on this ASAP.

Former Member
0 Kudos

Hi Efam/SAPUI5 Experts,

Can please help me on this ASAP.

Former Member
0 Kudos

Hi Efam/SAPUI5 Experts,

Can please help me on this ASAP.

Former Member
0 Kudos

Hi Efam,

Thanks for the reply,i did the same way as you said.

I have tired the way,but if i maintain the KEY and Text field values as blank,the i am getting list as [object Object] or else if fill any values in the KEY and Text field,i am getting the combo box as empty list as shown in the attached image,whereas here the count of empty list is same as columns in the Tables.

View.js:

var oComboBox_FunArea = new sap.m.ComboBox({ items:{ path: "/XYZSet", template : new sap.ui.core.Item({ key:'{ABC}', text:'{ABC}' }) };

Controller.js:

var sServiceUrl = ("proxy/http/____________:8000/sap/opu/odata/SAP/YREQSUB_SRV/");

var oModel = new sap.ui.model.odata.ODataModel(sServiceUrl,true);

this.getView().setModel(oModel);

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

Can you please advise me,what does the KEY field in sap.core.item exactly required for and can i

maintain the same values in KEY and Text fields.

Former Member
0 Kudos

Hi Efim,

Firstly thanks for the reply !!

pls find my code below and correct em if i am wrong,as this is my first project in SAPUI5

View.js :

var oComboBox_FunArea = new sap.ui.commons.ComboBox("FunArea",{Items:{path:"/sServiceUrl"}});

controller.js:

onInit: function() {

var sServiceUrl = ("proxy/http/____________:8000/sap/opu/odata/SAP/YREQSUB2_SRV/");

var oModel = new sap.ui.model.odata.ODataModel(sServiceUrl,true);

this.getView().setModel(oModel);

}

or else please help me with more detail elaboration of code.

former_member233511
Participant
0 Kudos

Its looks ok, except for ComboBox items binding.

1) You should find entitySet that represent data for you combobox items (navigate to your service url to find). You should bind items to entity set, not service name.

Or it can be relative binding through navigation property from specific entity, but i'm suppose this is not your case.

2) Set template for each item of this set as i shown above.

former_member233511
Participant
0 Kudos

Hi! If you have oData entity sets that represent data for paticular combobox, you can directly bind it to ODataModel:

//You have default ODataModel with entity set ComboBoxData1 that contains set of key-value pairs
new sap.m.ComboBox({
items:{ path: '/ComboBoxData1', template: new sap.ui.core.Item({ key: '{keyProp}', text: '{textProp}'
})
}
})