cancel
Showing results for 
Search instead for 
Did you mean: 

Delete SAP HANA Table Created By odata.draft.enabled

DimoUzunov
Participant

Hello experts,

In my SAP CAP Project I have a .cds file that generates draft tables for one of my entities the following way

service service_name { entity entity_name1 as projection on projectionName1; annotate entity_name1 with @odata.draft.enabled; entity entity_name2 as projection on projectionName2; entity entity_name3 as projection on projectionName3;}
This code works and deploys successfully.

However in the process of working and improving our CAP project we wanted
To simplify our structure and remove entity_name1 from our service_name. Problem comes when we delete the:
annotate entity_name1 with @odata.draft.enabled;
line.

Even though all draft tables are empty we still can't "remove" or "delete" them.
Neither by removing this line nor automatically via DROP TABLE name_of_draft.
Error I'm getting while deploying our HDI container is the following:
Error: The file requires "db://SERVICE_NAME_DRAFTADMINISTRATIVEDATA" which is not provided by any file [8212001] (STDERR, APP/TASK/deploy)#

Keep in mind my actual service, entities and projections are not called this way. I'm changing them from privacy regulations.

Accepted Solutions (1)

Accepted Solutions (1)

lothar_bender
Advisor
Advisor

I assume that the error is caused by an obsolete draft table that still exists in the HANA database.

The db folder of your project might already contain a undeploy.json file. In order to ensure that draft tables are also getting deleted in case the @odata.draft.enabled annotation is removed, you may want to add the following wildcards. This ensures that matching artifacts existing in the HANA database, but NOT contained in the set of deployed artifacts, will be deleted from the database. Thus, it ensures consistency of your CDS model and the HANA database schema.

[
  "src/gen/**/*.hdbview",
  "src/gen/**/*.hdbindex",
  "src/gen/**/*.hdbconstraint",
  "src/gen/**/*_drafts.hdbtable"
]
DimoUzunov
Participant
0 Kudos

You're a life saviour! Thank you!

Answers (0)