If you are creating CDS views and importing it as a reference data source in SEGW, you may face ST22 dump or exception while generating runtime objects. It happens du a very small error in CDS.

 

The below CDS is created. (incorrect One)

 

@AbapCatalog.sqlViewName: 'ZAAA'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'CDS'
@OData.entitySet.name: 'accidentSet'
@OData.entityType.name: 'accidentType'
@VDM.viewType: #CONSUMPTION

define view ZAAAA as select from za
{

key za.value as value,
    za.text as text
}

Import the CDS view as referecne in SEGW project.

Now if you try to generate the runtime object, you will get the below ST22 dump.

 

To resolve this, please follow the naming 

@OData.entityType.name: 'accidentType'

Entity type name should always end with ‘Type’.

 

And entitySet name should be always the entity name without the type, in this case it will be 

@OData.entitySet.name: 'accident'

 

Correct CDS:

@AbapCatalog.sqlViewName: 'ZAAA'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'CDS'
@OData.entitySet.name: 'accident'
@OData.entityType.name: 'accidentType'
@VDM.viewType: #CONSUMPTION

define view ZAAAA as select from za
{

key za.value as value,
    za.text as text
}

Now, if you regenerate the object, SAP will not give you error. Hope this helps. Good luck coding! 🙂

Tags: OData
Sara Sampaio

Sara Sampaio

Author Since: March 10, 2022

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x