Search code examples
httprequestodatasapui5abap

SapUI5 odata v4 calling function error "unknown operation"


I would like to call a function import with the odata v4 model, but I get an error. The error message is “Unknown operation:”. I think, “operation” means the kind of http request get or post, or? My code looks like this:

        const dDates = oSelectedDates.map(oDateTemp => oDateTemp.getStartDate());
        var oContext = this.getView().getModel("kddietz").bindContext(`/KddietzTourenplan(${oTourenplan.NId})/CopyTourenplan(...)`);
        oContext.setParameter("dDates", dDates);
        oContext.execute();

enter image description here

My metadata looks like this: enter image description here


Solution

  • I have solved the problem. After one day of debugging, i found out, that sap ui5 needs a namespace for funtion imports and actions. Also if the function is in the default namespace. I can bind the function with "/KddietzTourenplan(${oTourenplan.NId})/Default.CopyTourenplan(...)"