cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Eclipse CDS Virtual element

marco_paciucci_danone
Participant
0 Likes
2,752

Hello everyone,

I've created a CDS view in eclipse and one column should be filled with data pulled out of SAP S/4 HANA. I have seen that we can use virtual element to this purpose but since my CDS view is used in an ALP template I get this error "Calculated elements are not allowed in analytical".

I've created another view which does not contain any chart (apparently if a CDS view contains a chart it's automatically an analytical view) and everything works for that. When I access: "/Z_FALP_QMDASHBOARD_INSTR_CDS/Z_FALP_QMDASHBOARD_INSTR?sap-client=199&$top=10" the column contains the right data (ABAP debug stops in the method call).

I've then created a third CDS view which is a union with a fourth CDS view and the result of this union is used in the first view.

Finally there are 4 views:

- V1 (uses virtual elements)

- V2

- V3 = V1 Union V2

- V4 = analytic view which returns V3

The thing is that when I execute V4 the virtual element is not filled out (ABAP breakpoint not reached) but when I execute V1 it is.

How can I work this out?

Thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

maheshpalavalli
Active Contributor

you cannot use aggregations and virtual elements together. If the odata service entity that is linked to the cds view is having aggregation annotations then the virtual elemtns code will be skipped by SADL framework. One probable reason why sap did that is it will cause huge performance issue as you have to aggregate it at the abap level

mhappe
Participant
0 Likes

A possible solution for this scenario could be to add a "dummy" emtpy field instead of the virtual field.
Next create a separate odata project using SEGW based on your V4 cds view. In het DPC_EXT class redefine the relevant get_entityset method, first call the super implementation which will call the SADL framework to retrieve the data.

Next supply your dummy field with the right data using your logic. Maybe this could be an option for you, but it could cause some other issues regarding analytical features/