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: 

ODATA Publish Failed

fikretsomay
Participant
0 Kudos

Hi,

I ınstalled 7.50 developer sp02 on my computer. I got warnings when i want to activate Odata publish. I can see that view is created but service is not created, and I dont see my service on /IWFND/MAINT_SERVICE.

could you help me to fx this?

  1. No access control for entity ZMARA_DDL. Create DCL or use annot. AccessControl [Access Control Management]
  2. OData exposure failed due to missing key elements in 'ZMARA_DDL' [OData Exposure]
  3. The service ZMARA_DDL_CDS does not exist [OData Exposure]

My code as follows:

@AbapCatalog.sqlViewName: 'ZMARA_V_002'
//@AbapCatalog.compiler.compareFilter: true
//@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'ZMARA_DDL'

@ObjectModel.semanticKey: ['matnr']
@OData.publish: true 
define view ZMARA_DDL as select from zmara 
    {
        matnr,
        maktx 
     }

1 ACCEPTED SOLUTION

maheshpalavalli
Active Contributor

Hi Fikret,

Make one of the column as the key field and try to activate again.

BR,

Mahesh

5 REPLIES 5

maheshpalavalli
Active Contributor

Hi Fikret,

Make one of the column as the key field and try to activate again.

BR,

Mahesh

0 Kudos

Matnr column is already key in main table Zmara. Did you mean that?

0 Kudos

No, you need to make a field in the CDS view as key field so that it generates the OData service and creates the entity for that.. Even if you manually create a odata service, it is required to mention atleast one of the field in the entity as the key field. So here also in the CDS view it is required to mark one as a key.. (It will not take key from zmara btw, you need to explicitly mention it)

define view ZMARA_DDL as select from zmara 
    {
        key matnr,
        maktx 
     }

BR,

Mahesh

Thank you, that resolved my problem.

0 Kudos

Hi,

If you want to consume cds views in odata then rules should be meet are:

1. cds view should have at least one primary key in it.

2. no syntax error in ddl.

3 The length of cds view name should not be greater than 16

if above mentioned rules are fulfilled then in /IWFND/MAINT_SERVICE. we can find services.