How can I pass filter parameter in OData read method

前端 未结 1 1383
不思量自难忘°
不思量自难忘° 2020-12-07 00:16

I need to pass a parameter in my OData.

The URL has to be like this:

http://my_gateway_system:port/sap/opu/odata/sap/ZGW_TRANSF_APPROVAL_SRV_02/ztest         


        
相关标签:
1条回答
  • 2020-12-07 00:56

    You are using the legacy method call of ODataModel#read (with the parameters spread out). The current signature for this method is read(sPath, mParameters). Please check out the documentation of the method: https://openui5.hana.ondemand.com/#docs/api/symbols/sap.ui.model.odata.ODataModel.html#read

    In your concrete case, you should do something like:

    oModel.read("/ztest_nameset('RUBENS')", {
       filters: [/* your filters here */],
       success: function(oData) {
          oJsonModel.setData(oData);
       }
    });
    

    Nevertheless, it is not clear what filter parameter you want to pass. In your example, you have no filter. The /ztest_nameset('RUBENS') URI is just a plain entity set + key. It is also not clear what errors you get. I could guess that it can be a CORS issue. You seem to be making the OData calls to some other host than the one you are serving the UI5 app from.

    0 讨论(0)
提交回复
热议问题