Skip to Content
Nov 18 at 10:00 PM

CAP - Data manipulation operation not legal

154 Views Last edit Nov 19 at 07:18 AM 7 rev


I am trying the latest version of sap/cds : 5.6.3 . I have a simple calculation view which I am trying to use a update handler.This seems not working anymore.

//data model
entity CV_TEST {
  key ID  : Integer;
  book    : String(100);
  country : String(100);
  amount  : Integer;

//service Definition -------------------------------------------------------------------------------------
using CV_TEST as _CV_TEST from '../db/data-model'; service CatalogService @(impl: 'cat-service.js'){ entity TEST as projection on _CV_TEST; } //handler -------------------------------------------------------------------- this.before('UPDATE','TEST', async(req) => { console.log('Hi') });

Full project :

Error: When I do PUT on an entity http://localhost:8000/catalog/TEST(ID=1)

{<br> "error": { "code": "361", "message": "data manipulation operation not legal on this view: 
CV_TEST: line 1 col 8 (at pos 7)", "@Common.numericSeverity": 4 }}

It is a simple update handler on a view. I am not sure what is the mistake here.Can you please guide.