cancel
Showing results for 
Search instead for 
Did you mean: 

SAP CAP FIori / cds.env.fiori.bypass_draft` must be enabled or the entity

Paul11
Explorer
0 Kudos
258

I am creating a basic Fiori application on SAP BTP, using BAS as a CAP project following this tutorial: https://sap.to/6050RO5Es

When I start to test Fiori application I see this error when I try and edit an item (which used to work). Viewing data from HDI is working it's purely update:

`cds.env.fiori.bypass_draft` must be enabled or the entity must be annotated with `@odata.draft.bypass` to support direct modifications of active instances.

Here is my current CDS:

interactions.cds (within db directory):

namespace app.interactions;

entity StatusOptions {
key code : String(20);
name : String(50);
}

entity CloseCategoryOptions {
key code : String(20);
name : String(50);
}

entity AnomalyDetection {
key id : Integer;
company_code : String(10) not null;
process_area : String(10) not null;
identified_date : Date not null;
last_update : Date;
assignee : String(50);
notes : String(500);
close_category : Association to CloseCategoryOptions;
}
 
interaction_srv.cds (within srv directory):
using app.interactions from '../db/interactions';
service CatalogService {
@odata.draft.enabled: true
entity AnomalyDetections as projection on interactions.AnomalyDetection;
entity StatusOptions as projection on interactions.StatusOptions;
entity CloseCategoryOptions as projection on interactions.CloseCategoryOptions;
}

I tried updating to the below:
using app.interactions from '../db/interactions';

service CatalogService {
@odata.draft.enabled: true
@odata.draft.bypass
entity AnomalyDetections as projection on interactions.AnomalyDetection;

@odata.draft.enabled: true
@odata.draft.bypass
entity StatusOptions as projection on interactions.StatusOptions;

@odata.draft.enabled: true
@odata.draft.bypass
entity CloseCategoryOptions as projection on interactions.CloseCategoryOptions;
}

Which then gave me a new error of even though I have no drafts (it seems going into draft created a draft which blocks it).
Error

 
A draft for this entity already exists



Any help would be much appreciated! 




Paul11
Explorer
0 Kudos
Any ideas? The exact same setup was working before per tutorial...
gregorw
Active Contributor
0 Kudos
Could you describe in more details your edit flow? Do you use a Fiori Elements App and do you select multiple elements from the list report and click edit?

Accepted Solutions (0)

Answers (0)