cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with CallFunction of V2 Model

SandipAgarwalla
Active Contributor
0 Kudos

Hi

I have an issue with the call function of V2 Model. While calling the function import, the console errors out saying


"uncaught (promise)   undefined

(anonymous function @ODataModel.js

My function call is as below


var entry = {

  'CountBack':'X',

  'CountBack_Lvl':'X',

  'CountBack_SLvl':' ',

  'Def_No_Of_Hu':'2' 

  };

oModel.callFunction("/DemoEWM","GET",entry,null,function(oData,oResponse){

  alert("success:"+oResponse);

  },function(oError){

  alert("error"+oError);

  });

I tried with POST too, but same results.

What is missing here. I am using 1.34 version of UI5

Thanks

Sandip

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Hi,

Maybe try setting the parameters explicitly. I'm using the callFunction method as follows (adapted it to have your values):


oModel.callFunction("/DemoEWM", {

     "method": "GET",

     urlParameters: {

          CountBack: 'X',

          CountBack_Lvl: 'X',

          CountBack_SLvl: ' ',

          Def_No_Of_Hu: '2'

     },

     success: function(oData, oResponse){

          //Handle Success

     },

     error: function(oError){

          //Handle Error

     }

});

Regards

Albert Volschenk

0 Kudos

With explicit parameters the error is not coming up.

Correction: it should be method, not "method"

Answers (1)

Answers (1)

Former Member
0 Kudos

You may need to get x-csrf token first.

SandipAgarwalla
Active Contributor
0 Kudos

Thanks Rajeesh

Do you mean refreshSecurityToken?

Can you provide a code snap.

Thanks

Sandip