I created GWS and the URI is like:
/sap/opu/odata/sap/ZGW_GET_PO_SRV/PurchaseOrdersSet?$filter=PURCHORD eq 'XXXX' and PURCHORD eq 'XXXX'
I have 5 filters like PURCHORD ,VENDORNO ,Material... , meanwhile I set PURCHORD ,VENDORNO as the Key.
URL testing looks good.
But when this GWS goes to C# program(it's invoked as a service), and some coding like below to simulate filter value:
var uri = newUri(ConfigurationManager.AppSettings["PO"]);
var container = new PO.ZGW_GET_PO_SRV_Entities(uri);
try
{
var po = container.PurchaseOrdersSet.Where(p => p.PURCHORD == "XXXX"&& p.VENDORNO == "XXXX");
At the C# debug point I found the URL comes out is like below:
XXXXXXX/sap/opu/odata/sap/ZGW_GET_PO_SRV/PurchaseOrdersSet(PurchOrd='XXXX',VendorNo='XXXX')
That is Read not the Query so error happened. I know the reason is "the filter fields are the same as the key".
And if I change the key of the GWS(to avoid equal to filter fields), C# will come out right URL.
Should the C# program be changed? and How? Thanks.