cancel
Showing results for 
Search instead for 
Did you mean: 

oData $filter in URL

Former Member
0 Kudos

Hi all,

when trying to call method GetEntitySet with $filter extension, I'm getting the following error:

failed400,Bad Request,{"error":{"code":"005056A509B11ED1BDD3D7B1A3B4C509","message":{"lang":"de","value":"Die Anforderungs-URI ist ungültig. Das Segment 'EtDbDatenQ1AnzSet' verweist auf eine Entitätsmenge und nicht auf eine einzelne Entität"},

It says: Segment EtDbDatenQ1AnzSet is an entityset and not an single entity...

If I call the service via browser or Gateway Client, everthing works fine:

But how do I call it via UI5. The normal call for the hole model would be:


var oModel = new sap.ui.model.odata.ODataModel("/sap/opu/odata/sap/Z_ZMAIN_DBD_DASHBOARD_TEST_SRV/", true);

If I don't want to get the hole model at once (because it's a lot of data), how do I call it then:


var oModel2 = new sap.ui.model.odata.ODataModel("/sap/opu/odata/sap/Z_ZMAIN_DBD_DASHBOARD_TEST_SRV/EtDbDatenQ1AnzSet?$filter=Datum eq '20160212'", true);

I'm getting an error calling the Model this way...

Thanks in advance...

Accepted Solutions (1)

Accepted Solutions (1)

gill367
Active Contributor
0 Kudos

Hi

Check the code in the correct answer here

ODataModel.read: pass select and filters | SCN

Pass the filter as URL parameter in the read call.

Regards,

Sarbjeet Singh

Former Member
0 Kudos

Hi Sarbjeet,

thanks for the information. To understand the model concept, if I call e.g.:


var oModel = new sap.ui.model.odata.ODataModel("/sap/opu/odata/sap/ZMAIN_DBD_DASHBOARD_SRV/", true);

Does this already delivers the hole infomration like all the json data from the GetEntitySet method, or does this call only delivers the metadata of the service? If it only delivers the metadata of the service, I'm fine. If this call already delivers all the data, I will have a problem or does the read get the real data from the backend?

Thanks in advance...

gill367
Active Contributor
0 Kudos

You are right this is only metadata call. Actuall call for fetching the data happens in the read call.

Regards,

Sarbjeet Singh

Former Member
0 Kudos

Thanks - helped a lot!

Answers (0)