cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Unable to send a bound action call v4 oDataModel

parul_ng
Member
0 Likes
2,748

Hi Experts

I am trying to create an action call to RAP OData v4 service.But getting an error "Not a bound action" .When i pass this context oModel.bindContext("/MemRegReq('NGBTPADMIN20231207142608')/com.sap.gateway.srvd_a2x.zsd_mem_regreq.v0001.submitMemRegn(...)");
When I remove (...), I get an error"Binding must be deferred.Can you tell me where am I going wrong?

Here is the code snippet:

var oModel = this.getOwnerComponent().getModel();var contactsPersonArray = oContactsModel.getProperty("/contacts"); var oModelContext = oModel.bindContext("/MemRegReq('NGBTPADMIN20231207142608')/com.sap.gateway.srvd_a2x.zsd_mem_regreq.v0001.submitMemRegn"); oModelContext.setParameter("ReqID" , "NGBTPADMIN20231207142608"); oModelContext.setParameter("Reqtype", "NEWREG"); oModelContext.setParameter("Isdraft", false); oModelContext.setParameter("_newReg", newreg); oModelContext.setParameter("_contactPersons",contactsPersonArray); oModelContext.execute('$auto',true).then( function () { console.log("success"); }, function (oError) { console.log("error",oError.mesaage); }) ;

Accepted Solutions (0)

Answers (2)

Answers (2)

medhoohsao
Discoverer
0 Likes

Your first link seems ok oModel.bindContext("/MemRegReq('NGBTPADMIN20231207142608')/com.sap.gateway.srvd_a2x.zsd_mem_regreq.v0001.submitMemRegn(...)"), but there is a concen. Check your metadata, and make sure there is no alias for your service. It could be 'SAP__self' you need to use alias if there is, rather than the service technical name 'alias.action(...)'.

thecoldstone
Product and Topic Expert
Product and Topic Expert
0 Likes

In ODATAv4 it is required to have '(...)' while binding the context. Please check docs for further information https://sapui5.hana.ondemand.com/#/api/sap.ui.model.odata.v4.ODataContextBinding. Otherwise, you can simply debug bindContext method in the browser and you will see how it does actually work.