I have to pass two filter parameters to ODATA service. I am trying it as follows:
new ODataModel("proxy/http/FIORI-DEV.abc.com:8000/sap/opu/odata/sap/Z_FI_PAY_D_SRV/PdetailSet?$filter=Laufi eq '"+spayid+"' and Laufd eq '"+spaydt+"'?$sap-client=100",
It is giving following error. GET http://localhost:63655/Payment1/proxy/http/FIORI-DEV.abc.com:8000/sap/opu/odata/sap/Z_FI_PAY_D_SRV/PdetailSet/$metadata?$filter=Laufi%20eq%20%27U2-28%27 400 (Bad Request) Log-dbg.js:456 2020-07-21 16:40:39.956774 [ODataMetadata] initial loading of metadata failed -
Can anyone suggest correct way to add filter parameters on ODATA service. Thanks.
When you create a new OData model, then you can not provide any filters. You have to provide the base URI of the service.
Filtering by value happens automatically by the UI5 framework based on a context binding.
new ODataModel("proxy/http/FIORI-DEV.abc.com:8000/sap/opu/odata/sap/Z_FI_PAY_D_SRV/")
(or even better: you define your model using your manifest.json).view.setModel
controlWhichShowsTheThing.bindObject
and will perform an HTTP request to the OData model to retrieve that object when required.Now you might ask "OK, so how does that binding path look"? This actually depends on the oData model itself and how it addresses individual objects.