Application Development and Automation 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: 
Read only

CDS view error

Former Member
0 Likes
12,771

Hello,

I am creating a CDS view. After I activate the view, i get error that database (defined here --> @AbapCatalog.sqlViewName:) view does not exist.

Pls. let me know if anyone has any inputs.

Thanks.

4 REPLIES 4
Read only

NagaPrakashT
Contributor
0 Likes
4,019

Hi Kumail,

The annotation "@AbapCatalog.sqlViewName:" is mandatory when you create a CDS entity in Eclipse IDE. It will create CDS database view which can be viewed in SE11.

For more information, please see the documentation

ABAP CDS - Views - ABAP Keyword Documentation

Thanks,

Naga

Read only

Former Member
0 Likes
4,019

Hi Saif,

Please provide the name like below. Here 'ZTEST_VIEW' name is going to store in DDIC. We can able to see this view name by using SE11 Tcode. We can only view the view but not support to edit in the se11.

Ex:

@Abapcatalog.sqlViewName: 'ZTEST_VIEW'

Please do let me know if any issue.

Thanks,

Thiru.G

Read only

Former Member
0 Likes
4,019

Hi,

Find sample codes below. sqlViewName is mandatory since the new DDL sql view is going to be create at se11 in back of the CDS view. Means that every CDS view would have the sqlViewName at DDIC level.

In the below example the DDL sql view will be created in DDIC under name 'ZTEST_CDS' with fields MANDT, MATERIAl and TEXT. So sqlViewName is always mandatory.

Sample code 1.

@AbapCatalog.sqlViewName: 'ZTEST_CDS'

define view ztest_cds1 as

select from makt

{ matnr as material,  maktx as text  }

;

Sample code 2.

@AbapCatalog.sqlViewName: 'ZCDS_CURR_VW'

@AbapCatalog.compiler.CompareFilter: true

@AccessControl.authorizationCheck: #CHECK

@EndUserText.label: 'Currency conversion'

define view Zcds_Curr   with parameters           

                           To_curr:abap.cuky(5) ,                  

                            exdate:abap.dats

       as select from konp

   { knumh , kschl as condition_type, kbetr, konwa as source_currency,

        currency_conversion( Amount => kbetr,        

                          source_currency => konwa,

                          round => 'X',

                          target_currency => :to_curr,

                          exchange_rate_date  => :exdate,

                          error_handling => 'SET_TO_NULL' ) as amount,

     :to_curr as currency } where knumh = '0000008169

In sample 2 a DDl sql view will be created at DDIC under name 'ZCDS_CURR_VW' with fields

MANDT

KNUMH

CONDITION_TYPE

KBETR

SOURCE_CURRENCY

AMOUNT

CURRENCY.

Thanks,

Kala L.

Read only

Former Member
0 Likes
4,019

Hi Kumail,

@AbapCatalog.sqlViewName annotation is required to create corresponding SE11 object. The object type of this object is "VIEW" and can be checked in table TADIR also.


Any HANA table/view can't be used from AS ABAP if corresponding structure is not present in DDIC. For same, SAP has made this annotation mandatory which creates SE11 view object.


PS: You can ping me on Lync for any issue.


Thanks,

Sumit