Skip to Content

Binding data from Odata function Import in SAPUI5 XML Views

Hi all,

Recently I had an requirement, wherein, I had to bind the data from my function imports in odata services to my controls in XML view.

However, most of the solutions i found had achieved the same by doing a “oModel.callFunction()” in their controllers.

I was able to find a solution and thought I would share it in a blog post here.

Here is the sample code

<MultiComboBox items="{ path:'/myFunctionImport', parameters: { custom: { 'param1': '\'value1\'' } } }">
  <core:Item key="{Id}" text="{Text}"/>



You must be Logged on to comment or reply to a post.
  • Hello Krishna,

    Thank you to sharing the information, could you please give more details? how you can set values of your parameters from controller to XML?


    Many Thanks,


  • Hello Krishna,


    I would like to ask you that if it possibile to use a binded field instead of theĀ '\'value1\''.

    Let me explain this via my example:


    in my detail.controller I use bindElement to bind an object to the dialog:

    onShowParticipants: function(oEvent) {
    			var sDialogFragmentName = "smartgym.view.fragment.ShowTrainingParticipantsDialog";
    			var oView = this.getView();
    			// create dialog lazily
    			if (!this._oShowTrainingParticipantsDialog) {
    				// create dialog via fragment factory
    				this._oShowTrainingParticipantsDialog = sap.ui.xmlfragment(sDialogFragmentName, this);
    				// connect dialog to view (models, lifecycle)

    in the dialog fragment I want to call a function import using the {TrainingId} paramater which is one property of the binded Object (above in the detail.controller):

    				items="{ path: '/GetUsersofTraining', parameters: { custom: { 'TrainingId': '\'{TrainingId}\'' } }, sorter: { path: 'UserId', descending: false } }"
    				<StandardListItem title="{ path: 'UserName'}" />


    In tihs case the GET request looks like this:

    GetUsersofTraining?$skip=0&$top=100&$orderby=UserId asc&TrainingId='{TrainingId}'

    and I don't get any data.


    Do you have any advice, how can I do this in a right way?


    Many thanks,