cancel
Showing results for 
Search instead for 
Did you mean: 

Fiori UI5 "Failed to invoke: .. Unknown operation:" in OData V4

lgrabow7
Discoverer
0 Kudos
227

hello Community, 

I have the problem with UI5 development that I cannot call our action.

The error appears in the console: "Failed to invoke /PostGoodsMvT(...) - Error: Unknown operation: /PostGoodsMvT(...)"

I have already tested all the different methods from the OData Operations website OData Operations - Documentation - Demo Kit - SAPUI5 SDK (ondemand.com), but I always get the same e...

The metadata was created by the ‘SAP Fiori Application generator’ in Visual Studio Code. I have selected ‘Custom Page’.

Displaying data via CDS-views from the OData V4 service works without problems.

Only the action call does not work. My ABAP colleague set up the OData V4 according to the RAP instructions. I have tested another OData V4 service which works with a different app and I get the same error.

My Code: (For this example, I have kept the parameters static without input.)
Call Action:

lgrabow7_0-1718012549222.png

View:

lgrabow7_1-1718012573934.png

Metadata:

lgrabow7_2-1718012595529.png

Error:

lgrabow7_3-1718012647083.png

lgrabow7_4-1718012667336.png


Best regards,

Lukas

 

 

View Entire Topic
junwu
Active Contributor

your action is bound, so you need to supply the entity for which the action should operate on

const bindingContext = this.getView().getBindingContext() ///this is an example. assume your view is bound to an entity

const oAction = this.getView().getModel().bindContext( "PostGoodsMvT(...)", bindingContext );

lgrabow7
Discoverer
0 Kudos

Thank you! it works:

var oBindingContext = this.getView().getBindingContext();

var oActionBinding = this.getView().getModel().bindContext("com.sap.gateway.srvd.zmm_ui_pgmvt_lite.v0001.PostGoodsMvT(...)", oBindingContext);

oActionBinding.setParameter("menge", sQuantity);

oActionBinding.setParameter("meins", sBaseUnit);