Quantcast
Channel: SCN : Unanswered Discussions - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 5115

Nested subquery in Odata

$
0
0

Hi,

 

I have two services, one for Customer List another for SalesOrders. I have defined navigation using the association relationship between the two entities. I am able to use the $expand on my odata query to get the Orders for a Customer as well as Customer Information for a selected Order.

Below is the service definition:

 

"com.company.sd.CustomViews::ZSD_CUSTOMER_LIST_VIEW" as "Customer"

  keys ("SAPClient", "Customer", "SalesOrganization")

  navigates ("Customer_Orders" as "His_Orders")

  aggregates always;

 

  "sap.hba.ecc::SalesDocumentHeader" as "SalesDocument"

  keys ("SAPClient","SalesDocument")

  navigates("Customer_Orders" as "CustomerInfo");

 

  association "Customer_Orders" principal "Customer"("Customer") multiplicity "1"

  dependent "SalesDocument"("SoldToParty") multiplicity "*";

 

My requirement is to find count of Sales Orders for all the Customers in a particular Sales Organization. I know that $count does not work with $expand. We have a count defined within the Sales Order model, so we can select only this column to get the results.

 

I tried using the query like:

sd/Services/ZSDCustomerSalesAreaData.xsodata/SalesDocument?$expand=CustomerInfo&$top=2&$format=json&$filter=CustomerInfo/SalesOrganization eq '7950'. However it gives an error 'Service exception: single-row query returns more than one row'

 

I also tried: /sd/Services/ZSDCustomerSalesAreaData.xsodata/SalesDocument?$expand=CustomerInfo&$top=2&$format=json&$filter=CustomerInfo/any(c: c/SalesOrganization eq '7950'). I get an error like 'No property 'any' exists in type 'sial.sapnext.sd.Services.ZSDCustomerSalesAreaData.CustomerType'

 

Any suggestion are appreciated.

 

Thanks,

Aamod.



Viewing all articles
Browse latest Browse all 5115

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>