ABAP Programming model for fiori CDS BOPF Draft delete error
Note: This scenario is not officially supported from SAP
This is a very short blog post to fix a small issue related to ABAP Programming model for Fiori .
Prior to SAP_BASIS release 7.54, If the ObjectModel.deleteEnabled annotation is set as abap_false in the cds view, then while deleting the draft, it will give an error that delete operations are disabled for that particular entity.
You can check the below question/answer for more information.
Like suggested in the answer, you could dynamically manipulate the delete field control in the determination. But this will always show the delete button.
A better alternative would be to simple hide it in the Fiori App and enable the delete operation in the backend. So for hiding the delete button, we can use annotations.
1.Create the annotation file, if it doesn’t exists.
2.Select the relevant entitySet (not the entity)
3. Create the DeleteRestrictions annotation for that entity and add Deletable annotation with value false.
That’s it, it will hide the delete button in the Fiori app both in the list report and in the object page, but delete will still work in the backend. Doing this will solve will stop the draft delete error.