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 Activation Error (Tutorial)

Former Member
9,333

Hi all,

I just newly installed the AS ABAP 752 SP04 developer edition and started up trying to create a CDS view by making the tutorial offered here:

https://help.sap.com/viewer/cc0c305d2fab47bd808adcad3ca7ee9d/1709.000/en-US/a7ef7d66047e4a779c0d5f99...

Unfortunately when trying to activate the CDS view I get the following error message.

DDLS ZDEMO_CDS_SALESORDERITEM was not activated

also there is a second error I did not have in my first try:

DDL source ZDEMO_CDS_SALESORDERITEM contains errors

Does anyone know what's the problem? I am confusred because I copied and pasted the source code 1 by 1.

------------------------------------------------------------------------------------------------------------------------------------------------------

Source Code:

@AbapCatalog.sqlViewName: 'ZDEMO_SOI_001'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'List Reporting for Sales Order Item'
@OData.publish: true

define view ZDEMO_CDS_SalesOrderItem as select from SEPM_I_SalesOrderItem_E as Item {
key Item.SalesOrder as SalesOrderID,
key Item.SalesOrderItem as ItemPosition,
Item._SalesOrder._Customer.CompanyName as CompanyName,
Item.Product as Product,
@Semantics.currencyCode: true
Item.TransactionCurrency as CurrencyCode,
@Semantics.amount.currencyCode: 'CurrencyCode'
Item.GrossAmountInTransacCurrency as GrossAmount,
@Semantics.amount.currencyCode: 'CurrencyCode'
Item.NetAmountInTransactionCurrency as NetAmount,
@Semantics.amount.currencyCode: 'CurrencyCode'
Item.TaxAmountInTransactionCurrency as TaxAmount,
Item.ProductAvailabilityStatus as ProductAvailabilityStatus

Thanks a lot in advance!

Best regards.

1 ACCEPTED SOLUTION
Read only

Former Member
5,716

1. Try changing your code from: @AbapCatalog.sqlViewName: 'ZDEMO_SOI_001'

to: @AbapCatalog.sqlViewName: 'ZDEMO_SOI'

*

because:

Your code says: @AbapCatalog.sqlViewName: 'ZDEMO_SOI_001'

But Sample Code says: @AbapCatalog.sqlViewName: 'ZDEMO_SOI'

2. You have 2 extra statements (not in sample code).

Have you tried removing your 2 extra lines (which are not in sample code)?

@AbapCatalog.preserveKey: true
*

*
@OData.publish: true

3. Have you tried putting this statement on 2 lines as in sample code (instead of on 1 line as in your code):

define view ZDEMO_CDS_SalesOrderItem

as select from SEPM_I_SalesOrderItem_E as Item

4. After your code, Insert closing bracket which is at end of sample code on its own brand new line:

}

5. Also I'd suggest making your spacing look exactly like spacing in sample code

6. Should you create a view called: view ZDEMO_CDS_SalesOrderItem

7. activate; make sure your code activates successfully, no errors/informational messages

6 REPLIES 6
Read only

Former Member
5,717

1. Try changing your code from: @AbapCatalog.sqlViewName: 'ZDEMO_SOI_001'

to: @AbapCatalog.sqlViewName: 'ZDEMO_SOI'

*

because:

Your code says: @AbapCatalog.sqlViewName: 'ZDEMO_SOI_001'

But Sample Code says: @AbapCatalog.sqlViewName: 'ZDEMO_SOI'

2. You have 2 extra statements (not in sample code).

Have you tried removing your 2 extra lines (which are not in sample code)?

@AbapCatalog.preserveKey: true
*

*
@OData.publish: true

3. Have you tried putting this statement on 2 lines as in sample code (instead of on 1 line as in your code):

define view ZDEMO_CDS_SalesOrderItem

as select from SEPM_I_SalesOrderItem_E as Item

4. After your code, Insert closing bracket which is at end of sample code on its own brand new line:

}

5. Also I'd suggest making your spacing look exactly like spacing in sample code

6. Should you create a view called: view ZDEMO_CDS_SalesOrderItem

7. activate; make sure your code activates successfully, no errors/informational messages

Read only

maheshpalavalli
Active Contributor
5,716

Can u try providing the screenshot of the error and screenshot of your code as well.

Read only

Former Member
5,716

Hi Joanna,

thanks a lot for your quick reply. It was helpful

Anyhow I could not enter 'ZDEMO_SOI' because this did already exist in the system, so I was getting the error message "ZDEMO_SOI is already defined as structure or table"

But just renaming it to ZDEMO_SOI2 did help.

Your other points were helpful. The bug has been fixed. Anyhow one error is still remaining, which I am trying to fix:
No access control for entity ZDEMO_CDS_SALESORDERITEM. Create DCL or use annot. AccessControl [Access Control Management]

The source code:

@AbapCatalog.sqlViewName: 'ZDEMO_SOI2'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'List Reporting for Sales Order Item'

define view ZDEMO_CDS_SalesOrderItem
as select from SEPM_I_SalesOrderItem_E as Item {
key Item.SalesOrder as SalesOrderID,
key Item.SalesOrderItem as ItemPosition,
Item._SalesOrder._Customer.CompanyName as CompanyName,
Item.Product as Product,
@Semantics.currencyCode: true
Item.TransactionCurrency as CurrencyCode,
@Semantics.amount.currencyCode: 'CurrencyCode'
Item.GrossAmountInTransacCurrency as GrossAmount,
@Semantics.amount.currencyCode: 'CurrencyCode'
Item.NetAmountInTransactionCurrency as NetAmount,
@Semantics.amount.currencyCode: 'CurrencyCode'
Item.TaxAmountInTransactionCurrency as TaxAmount,
Item.ProductAvailabilityStatus as ProductAvailabilityStatus
}

Read only

5,716

It is just a warning that authorizations cannot be implemented as the access control is not created. Use the below annotaiton if you don't have access control defined.

@AccessControl.authorizationCheck:#NOT_REQUIRED
Read only

Former Member
5,715

data-definition-zdemo-cds-salesorderitem-npl.jpg

@ Mahesh Kumar Palavalli: Here is the screenshot!

Read only

Former Member
5,715

Great! Thanks!