cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Getting error when using @odata.draft.enabled annotation CAP - Fiori Elements - CRUD

former_member604560
Participant
0 Kudos
4,463

Hi All,

When I am using @odata.draft.enabled it gives me the below error.

invalid table name: Could not find table/view CATALOGSERVICE_INTERACTIONS_HEADER_DRAFTS in schema MYHANAPROJECT_HDI_MYHANAAPP_DB_DEPLOYER_1

But removing the annotation it gives me the data while calling service.

Have attached below code

using app.interactions as my from '../db/interactions';
@path:'catalog/' 
service CatalogService {
   
@odata.draft.enabled
entity Interactions_Header as select from my.Interactions_Header;

entity Interactions_Items
    as projection on  my.Interactions_Items;
 
}
namespace app.interactions;

using { Country } from '@sap/cds/common';
type BusinessKey : String(10);
type SDate : DateTime;
type LText : String(1024);


entity Interactions_Header {
  key ID : UUID;
  ITEMS  : Composition of many Interactions_Items on ITEMS.INTHeader = $self;
  PARTNER  : BusinessKey;
  LOG_DATE  : SDate;
  BPCOUNTRY : Country;

};
entity Interactions_Items {

    key INTHeader : association to Interactions_Header;
    key TEXT_ID : BusinessKey;
        LANGU   : String(2);
        LOGTEXT : LText;
};

Accepted Solutions (1)

Accepted Solutions (1)

former_member604560
Participant

Redeployed once again. It worked. thanks @vladislav.leonkev

Answers (2)

Answers (2)

former_member604560
Participant
0 Kudos

Done. But still the same error exists.I am just wondering why it is expecting CATALOGSERVICE_INTERACTIONS_HEADER_DRAFTS Since I done have _DRAFTS table in my db

Redeployed once again. It worked. thanks @vladislav.leonkev

ajmaradiaga
Developer Advocate
Developer Advocate
0 Kudos

meenakshian0801 It is possible that you have not deployed the db components. You can check the tables in the database, if it is not there (as the error says), try building - cds build - and deploying the db components. Depending on how you've setup your project, it can be deployed from SAP Business Application Studio or by running "npm start" from within the db folder.

ajmaradiaga
Developer Advocate
Developer Advocate
0 Kudos

It expects the table because of the @odata.draft.enable annotation you have in entity Interactions_Header.

Paul11
Explorer
0 Kudos
Thanks