<innererror>It is only possible to specify a filter for a feed.</innererror>Hi Team,
I am trying to call a gateway service from SAP UI5 and receiving below error in google chrome.
<innererror>It is only possible to specify a filter for a feed.</innererror>
Failed to load resource: the server responded with a status of 404 (Not Found)
I am running chrome with SOP disabled. Can you please let me know if any one else have seen similar issue ?
Yes i am using $filter. Here is complete line of code.
var oModel = new sap.ui.model.odata.ODataModel("http://servername:8000/sap/opu/sdata/sap/INBOXITEMS/InboxWorkItems?$filter=LoginID EQ 'testuser'&sap-client=100&$format=xml", false, "testuser", "test123");
Please let me know your thoughts.
I am thinking that perhaps your URL isn't correct. What happens when you paste this URL into a new browser window? Have you tried $metadata - do you get a response then?
I notice too that this format seems to work to apply a filter:
Sorry I can't help you more. My approach would be make sure it works outside of SAPUI5 e.g. in a browser first... then start looking at possible issues due to SAPUI5 integration.
Hope this helps,
To create an instance of an ODataModel you pass the Gateway Service URL.
Var sServiceURL = "http://servername:8000/sap/opu/sdata/sap/INBOXITEMS/",
oModel = new sap.ui.model.odata.ODataModel( sServiceURL, false, "testuser", "test123");
In your example you have passed the collection url with a filter operation.
One of the first things the ODataModel code does is request the services metadata, it does this by adding $metadata to the sServiceURL
this would explain why you were getting status of 404 (not found)
You can add additional parameters like &sap-client=100&$format=xml to the service URL so that they are present on every call.
For an example of using filters
I am currently facing the same problem and I would like to ask you how you resolved the issue?
My code is momently as follows:
var oModel = new sap.ui.model.odata.ODataModel("http://<hostname>:<port>/sap/opu/odata/sap/Z_RFC_UI5_HR_MA/");
But the URI I have to use is the following one:
http://<hostname>:<port>/sap/opu/odata/sap/Z_RFC_UI5_HR_MA/z_rfc_ui5_hr_maCollection?$filter=pernr eq '00000003'
I tested it in RESTClient in firefox and it retrieves the data.
I just do not know where to add the filter part (...?$filter=pernr eq '00000003') in the SAPUI5-code.
Would you be so kind to help?