cancel
Showing results for 
Search instead for 
Did you mean: 

CAP - Data manipulation operation not legal

mani_ac
Participant
0 Kudos

Hi,

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
-----------------------------------------------------------------------------
@cds.persistence.exists
@cds.persistence.calcview
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 : https://github.com/mani-gitarea/updateIssueCAP/

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.

gregorw
Active Contributor
0 Kudos

Please check the formatting of the source code and make it better readable.

mani_ac
Participant
0 Kudos
gregorw

Thank you for the reply..I have a full source code here.

https://github.com/mani-gitarea/updateIssueCAP/

It has one hdbtable and a calculationview on it .

I am doing an update handler on a calculation view which is getting called but failing with the above error.

Accepted Solutions (1)

Accepted Solutions (1)

vitaly_kozyura
Participant

Hi Manikandan, The error occurs in the database, which cannot do an update for a calc view. Please try to add the annotation @cds.persistence.skip and implement the custom logic completely (including .on handler): https://cap.cloud.sap/docs/guides/providing-services#custom-handlers

Answers (0)