on 08-20-2015 5:59 AM
Hello gurus,
I am facing a issue with the use of $count operation.
I also had a peak at the syntax in this.
URI:
/sap/opu/odata/SAP/ZPRO_ODA_SRV/SOListSet?$filter=SalesOrg eq '2000' and DistChan eq '03' and Division eq '00' and SalesOff eq '2001'/$count
Error snapshot:
Thanks,
Pavan G
Hello Pavan,
Check URL as below :
OData Query Options - SAP NetWeaver Gateway - SAP Library
$count ->
This will return only the count and data fetched is not displayed as part of GW response.
This dos not require any additional implementation in DPC level. GW frame work will it self will return the count.
$inlinecount ->
To get the Data and also the Count of the data fetched as part of GW Response you need to add some code in DPC level and sent that as count value.
add count to response -> example
DESCRIBE TABLE et_entityset LINES es_response_context-inlinecount.
This way response will have data and also the number of items fetched.
......?$filter=Delimiter eq '' and QueryTable eq '' and Text eq ''&$inlinecount=allpages
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Ashwin,
This is nice document.
I also read the with $filter, the $count considers the relevant result sets returned but I don't have any idea how does $count works with $filter.. Whch is my case.
Thanks,
Pavan G
yes Ashwin, after that I tried below URI's still could not identify the count of records which satisfy the $filter conditions
/sap/opu/odata/SAP/ZPRO_ODA_SRV/SOListSet?$filter=SalesOrg eq '2000' and DistChan eq '03' and Division eq '00' and SalesOff eq '2001'&?$inlinecount=allpages
/sap/opu/odata/SAP/ZPRO_ODA_SRV/SOListSet?$filter=SalesOrg eq '2000' and DistChan eq '03' and Division eq '00' and SalesOff eq '2001'&?$inlinecount
/sap/opu/odata/SAP/ZPRO_ODA_SRV/SOListSet?$inlinecount=allpages&?$filter=SalesOrg eq '2000' and DistChan eq '03' and Division eq '00' and SalesOff eq '2001'
Still not got count,
but Http response is 'accepted' but their is no sign of count shown anywhere.
Regards,
Pavan G
Hello Pavan,
It will work.
Check again
URL -> Sample for understanding and which is working for me as well.
/sap/opu/odata/sap/ZGW_TEST_SERVICE_SRV/GetDataSet?$filter=ImAging eq 180 and ImLcAmnt eq 20&$expand=GenItems&$inlinecount=allpages
Add code in DPC ->
DESCRIBE TABLE lt_gen_items LINES es_response_context-inlinecount.
Where lt_gen_items is your final internal table which is holding all the data to be shown as part of GW response.
OutPut ->
Count of 1257 records are fetched and data is displayed as well.
Regards,
Ashwin
Hi Pavan,
Use the below URL for count.
/sap/opu/odata/SAP/ZPRO_ODA_SRV/SOListSet/$count?$filter=SalesOrg eq '2000' and DistChan eq '03' and Division eq '00' and SalesOff eq '2001'
Regards,
Venu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
1. Whats there in /IWFND/ERROR_LOG ?
2. Without $count , are you getting result sets returned ?
3. Any dump in Business suite or Gateway ?
Sree
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.