on ‎2023 Jan 06 12:25 PM
Hi,
I Successfully added a virtual element to my CDS, now I noticed this field is not available as filter. Is there anyway I can make this available?
I currently have the annotation @ObjectModel.virtualElementCalculatedBy active. This works fine.
When I combine it with @ObjectModel.filter.transformedBy, I get a dump: CX_SADL_DUMP_APPL_MODEL_ERROR.
I implemented both methods MAP_ATOM and CALCULATE.
I can find an example where a combination is used: Adding Annotations for Virtual Elements | SAP Help Portal
regards,
Robbe
Request clarification before answering.
Hi Robbe,
To make the field available in filter, you can use the annotation ui.selectionfield.
However, since the field in discussion is a virtual field, filtering won't work out of the box. You can try implementing filter exit referring below blog. I have tried and this works perfectly fine for me
In case this doesn't work, I would request you to share the exit class code and the error screenshots.
Thanks,
Aman Garg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
in both the cases, the field in discussion is not a persisted field, so behaviour should be same. In my case, it was a calculated field, and I could filter it this way. The only difference is I used keyword VIRTUAL (in front of CAST keyword) instead of @objectMode.virtualElement: true. Although, these two are pretty much the same but you can give this a try.
Also, does control reach the map_atom method or does it dump before this? An error screenshot would help in understanding the problem much better.
Thanks,
Aman Garg
Hi,
This is what I mean by keyword virtual:

Could you try this way?
Also, as you say that filtering works but it dumps, this might be because you have used virtual elements in Interface layer. Could you try creating a projection view on top of your main(interface) CDS view and use virtual key word instead of annotation. I hope then it should work.
Thanks,
Aman Garg
| User | Count |
|---|---|
| 11 | |
| 7 | |
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.