cancel
Showing results for 
Search instead for 
Did you mean: 

Filter with range on ODATA Batch APIs gives incorrect output

Hello experts,

I'm trying to use SAP ODATA APIs for a business requirement for sales dashboard and have observed the below anomaly while trying to filter data between two tx amounts in the query. Below is a snapshot of a table simplified to help set the context. I have a set of transactions with C_D meaning a credit or Debit type of transaction. Im interested to see month wise Debit & Credit groups where Tx amounts are between 60 to 90 (Both inclusive)

Below Query in SQL is giving the right result

select C_D,Month,count(TxID),sum (Amount) from Sample2 where Amount>=60 AND Amount<=90 group by C_D,Month;

Correct output:

But when I try the same on SAP ODATA API, I see below query is giving incorrect output

select C_D,Month,count(TxID),sum (Amount) from Sample2 where Amount ge 60 AND Amount le 90 group by C_D,Month;

Upon some analysis, I have observed that the second filter condition <=90 is being applied after grouping is completed with the first filter condition i.e >=60 which is incorrect and against the SQL principles.

Request to suggest if there is something that can be done to implement a between functionality on the amount to obtain the right result.

former_member751591
Participant

Welcome to the SAP Community! We wanted to give you the opportunity to take the tutorial to get started in SAP Community, as it provides tips for preparing questions that draw responses from our members.

Additionally, by adding a picture to your profile you encourage readers to respond to your question. Learn more about your profile using Profile Tutorial

Thank you!

maheshpalavalli
Active Contributor

could you show us how the odata api is coded or is created to handle the aggregation?

Accepted Solutions (0)

Answers (0)