Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

CDS View for a range- how to create one?

former_member196098
Participant
0 Kudos
1,198

hi all,

I can not create a CDS view like this:

@AbapCatalog.sqlViewName: 'zddl_test2_hana'

@AbapCatalog.compiler.CompareFilter: true

@AccessControl.authorizationCheck: #CHECK

@EndUserText.label: 'test2'

define view Zddl_Test2

(vbeln,vkorg,vkgrp,erdat)

as

select from vbak {

'I' AS sign,

'EQ' AS option,

  vbak.vbeln AS low,

  ' ' AS high

} where augru <> ''

Its says that optıons is a reserved word which it

2 REPLIES 2

pfefferf
Active Contributor
0 Kudos
213

Hello Solen,

as for standard database views CDS views have also the restriction that reserved names may not be used as column names. OPTION is one of that reserved names. You can find all reserved names (and the reasons/hints why they are reserved) in table TRESE.

If appropriate for your case, you can set the alias "OPTION" for the column which should act as such column when you query the view e.g. from ABAP.

Regards,

Florian

0 Kudos
213

Thank you Florian

It will be good if we can use it once and reuse the code as a cds view.

Its eay to write it as open sql as below:

  SELECT 'I' AS SIGN,

         'EQ' AS OPTION,

         MATNR AS LOW,

          ' ' AS HIGH

   FROM MARA

  INTO  TABLE  @S_MATNR      .