Skip to Content
0
Nov 25, 2019 at 06:53 AM

CAPM - Performing CRUD operations on Views

288 Views Last edit Nov 26, 2019 at 03:17 PM 3 rev

Hi Experts.

Over the last few weeks I have been messing around with CAPM by building out a simple Doctor / Patient appointment booking scenario. Coming from a CRM background, my aim is to essentially test the Business Partner concept with CAPm whereby a person can take on multiple roles (i.e. a doctor can be a patient) and we need to normalise the data model do avoid replication of say Name, Surname etc.

In my scenario I have:

  • a persons-model.cds file in the /db folder which i have normalised into {Business_Partner, Business_Role, Patient, Practitioner} where Patients have business role "02" and Practitioners have the role "01"
  • a admin-service.cds file in the /srv folder which contains the Patient and Practitioner entities which are SELECTS across {Business_Partner, Business_Role, Patient} and {Business_ Partner, Business_Role, Practitioner} respectively

From what I understand (and what I observe from the database) is that the /srv Patient and Practitioner entities are generates as views. Consequently i am able to read Patients and Practitioners, but i am unable to perform Create, Updates or Delete operations.

What is the recommended approach form performing CRUD operations on entities that are views.

Any help will be appreciated

DJ Adams Christian Georgi Gregor Wolf

repo: https://github.com/scongia/theatremate.git