cancel
Showing results for 
Search instead for 
Did you mean: 

SAP CAP Java: Bug in CQNParser

0 Kudos

Wanted to report a bug. Not sure if this is the right place, but couldn't find another place to report this.

I'm using the CQN parser in CAP Java.

I have a CQN generated by a Fiori Elements application, so I assume it was generated correctly.

This is the query:

 {"SELECT":{"from":{"ref":["MainService.SalesOrders"]},"count":true,"columns":[{"ref":["ID"]},{"ref":["VBELN"]},{"ref":["AUART"]},{"ref":["VKORG"]},{"ref":["VTWEG"]},{"ref":["SPART"]},{"ref":["SOLDTO"]},{"ref":["SHIPTO"]},{"ref":["IsActiveEntity"]},{"ref":["HasActiveEntity"]}],"where":[{"ref":["IsActiveEntity"]},"is",{"val":false},"or",{"ref":["SiblingEntity","IsActiveEntity"]},"is","null"],"orderBy":[{"ref":["ID"]},{"ref":["IsActiveEntity"]}],"limit":{"rows":{"val":30}}}}

I converted this query to a string and then tried parsing it back to CQN as follows:

CqnSelect myCqn = context.getCqn();
String cqnString = myCqn.toString();
CqnSelect = Select.cqn(cqnString);

This code results in the following error:

ChangeSet 7 as cancelled: Unexpeceted token "false" at position 2. Expecting "null". (service 'MainService', event 'READ', entity 'MainService.SalesOrders')

However, this "false" at position 2 {"ref":["IsActiveEntity"]},"is",{"val":false}, is exactly as the application originally generated it. I didn't change this at all.

Accepted Solutions (0)

Answers (3)

Answers (3)

adrian_goerler
Employee
Employee
0 Kudos

We'll provide a fix for this issue with the next release.

For the time being please to avoid to serialize the statement to CQN and parse it again. Instead please consider to use the APIs for statement modification: https://cap.cloud.sap/docs/java/query-api#copy--modify-cds-ql-statements

0 Kudos

Thank you very much!

adrian_goerler
Employee
Employee
0 Kudos

Thank's for bringing this to our attention. We'll have a look.

robinjayasinghe
Advisor
Advisor
0 Kudos

Hi!

Could you please share which version of CAP Java you are using?

Thanks,

Robin

0 Kudos

Hi, sorry for the delayed response. I'm Using CDS Java 1.16.0