cancel
Showing results for 
Search instead for 
Did you mean: 

Getting error in CRUD operations while using sap.ui.model.odata.v2.ODataModel

Former Member
0 Kudos

Hi Experts,

I'm getting error in CRUD operations while using sap.ui.model.odata.v2.ODataModel.Before that let me explain what i did in sap.ui.model.odata.ODataModel.

This is my url = "/sap/opu/odata/xxxxx/xxx_OBJLIST_LIST_SRV/ObjListSet?$filter=Aufnr eq '7007204' and Screenid eq ''&$format=json";

var ServiceUrl = "/sap/opu/odata/xxxxx/xxx_OBJLIST_LIST_SRV/";

var sPath = "ObjListSet?$filter=Aufnr eq '" + selectedOrderListRow.Aufnr + "' and Screenid eq ''&$format=json";

var oDataModel = new sap.ui.model.odata.ODataModel(ServiceUrl,true);

         oDataModel.read(sPath, null,null,true,        

         function onSuccess(oData, oResponse)

         { 

               successFunc(oData);

         },

         function onError(oData, oResponse)

         {  

         });

it's working fine..but if i changed to sap.ui.model.odata.v2.ODataModel getting error.

So can you please explain how to integrate the services in sap.ui.model.odata.v2.ODataModel.

Thanks,

Palsaran

View Entire Topic
Former Member
0 Kudos

Hope this thread helps you find a solution

How to apply a filter to the oDataModel read fu... | SCN

Regards

Former Member
0 Kudos

Hi Rajeesh,

I've checked the thread which you gave me..but they didn't mention which odata model they are used because its working fine in v1 odata model..i'm facing the issue in v2 odata model only.

Thanks,

Palsaran

Khairwa
Explorer
0 Kudos

Hi, Pal

var oDataModel = new sap.ui.model.odata.ODataModel(ServiceUrl,true);

         oDataModel.read(sPath, null,null,true,      

         function onSuccess(oData, oResponse)

         {

               successFunc(oData);

         },

         function onError(oData, oResponse)

         {

         });

mParameters.async parameter is not there in sap.ui.model.odata.v2.ODataModel

read function.

Compare Parameters:

For V2

SAPUI5 SDK - Demo Kit

For V1

SAPUI5 SDK - Demo Kit

Regards,

Rajesh Kherwa

Former Member
0 Kudos

Hi Rajesh,

I've removed the mParameters.async parameter..Now i'm getting the new error

Thanks,

Palsaran

Khairwa
Explorer
0 Kudos

Hi Pal,

As error is saying order no is initial,

try to pass hardcoded sPath instead of deriving values from  'selectedOrderListRow'.

or check value of selectedOrderListRow.Aufnr at runtime.

regards,

Kherwa

Former Member
0 Kudos

Hi Rajesh,

Yes..I've checked..getting the value at runtime but i don't know why this kinda error coming. I think the way defined the path is wrong..But i tried many ways nothing work

Thanks,

Palsaran

Khairwa
Explorer
0 Kudos


var serviceUrl =  "/sap/opu/odata/xxxxx/xxx_OBJLIST_LIST_SRV/";

var oDataModel = new sap.ui.model.odata.v2.ODataModel(serviceUrl);


var parameters = "$filter=Aufnr eq '" + selectedOrderListRow.Aufnr + "' and Screenid eq ' '&$format=json";


oModel.read("/ObjListSet", {

    urlParameters:   parameters ,          

     success: function(oData, oResponse){       

     },

     error: function(oError){

     }

});


regards,

Kherwa

Former Member
0 Kudos

Thanks Rajesh..already i tried this way..no change..same result.

Thanks,

Palsaran

Khairwa
Explorer
0 Kudos

Try without URL parameters.