cancel
Showing results for 
Search instead for 
Did you mean: 

CAP Java: all CQN queries for Remote Service return the same response

0 Kudos

Hi experts. I've run into an odd error. I'm wondering if anyone has experienced this and knows how to resolve it.

I have a CAP Java application that connects to an on premise system using an oData V2 service.

I am able to send queries and get data back, but no matter what the query is, I always get the same response: it reads every single entity from the target table. For example, the following two queries provide an identical result:

CqnSelect maxEbelnQueryCloud = Select.from(PURCHASE_ORDER_SET);

CqnSelect maxEbelnQueryOnPrem = Select.from(PURCHASE_ORDER_SET).columns(c -> CQL.max(c.EBELN()).as("max"));

Could anyone provide any suggestions about what could be causing this?

gregorw
Active Contributor
0 Kudos

Have you tried the requests directly against the backend using i.e. REST Client or Transaction /IWFND/GW_CLIENT? What's the result there?

View Entire Topic
marcbecker
Employee
Employee
0 Kudos

Hi,

aggregation functions are not yet supported on CQN statements to remote OData APIs. Your selection of "CQL.max(c.EBELN()).as("max")" is currently simply ignored, which basically results in a "SELECT *", which is the same as your first statement.

The columns in the CQN are translated into an $select query on outgoing request. Therefore in columns we currently only support element references, which is basically the stuff thats actually also supported by a $select query parameter in OData.

Aggregation functions would require support for $apply, which is not yet considered in our remote OData implementation.

Best regards,
Marc

0 Kudos

Hello Marc,

Thanks a lot for your comment! I'll do my best to find a workaround.

jatin_shajan
Discoverer
0 Kudos

Hi Marc,

When will aggregations be supported to remote odata services in CAP? Is it already available?

Thanks,

Jatin

marcbecker
Employee
Employee
0 Kudos

No, it is not yet supported. There are currently no fixed plans to support it in the near future. You can track the feature details here for updates: https://cap.cloud.sap/docs/guides/using-services#querying-api-features