cancel
Showing results for 
Search instead for 
Did you mean: 

I am trying to create a virtual element for the CDS view and need to get the output as string or tex

Uttam3
Explorer
0 Kudos
249

When i put the virtual element, it keeps erroring out and says keyword localized is expected

Accepted Solutions (0)

Answers (2)

Answers (2)

AndreaUS
Product and Topic Expert
Product and Topic Expert

How about using LOCALIZED then?

Docu for LOCALIZED: CDS DDL - LOCALIZED | ABAP Keyword Documentation

 

 

Uttam3
Explorer
0 Kudos
it is not working, note that its a consumption view, I have simple requirement, I just want to declare the virtual element as a character type thats all, why is this so difficult
Uttam3
Explorer
0 Kudos
Hi @Andrea,
Uttam3
Explorer
0 Kudos
Hi @Andrea, It is a very simple requirement , I have one CDS view where I am doing all the calculation and then getting the data in an anlytical query.
AbhishekSharma
Active Contributor
0 Kudos

Hi @Uttam3 You may try to use annotations like below:

 

@ObjectModel.virtualElementCalculatedBy: 'ABAP:ZCL_OTC_0365_GET_SERIAL' 
@EndUserText.label: 'Serial No'
virtual serialNumber : char225

 

If char225 not work then try like abap.char225

For more details you may refer 

Thanks-

 

Uttam3
Explorer
0 Kudos
Virtual keyword is only for projection views
AbhishekSharma
Active Contributor
0 Kudos

true, what I understood by Virtual is - when we need to add new column which is not a part of original entity and may be calculated at runtime based on data available. Ideally all annotations and non entity columns in this case Virtual element or column should also go to Projection View. you should try to use Projection Views if possible... Thanks-