Skip to Content
0
Jun 05, 2020 at 02:55 PM

How to handle CRUD operation in Fiori Elements CAP project

1728 Views Last edit Jun 05, 2020 at 02:57 PM 2 rev

Hello,

I’m creating a Fiori Elements Application with SAP Cloud application Programming model .

I have already create My Odata backend service with CAPM on SAP Business Application studio and I deployed it to SCP CF environment with the model and service definition below :

model.cds

namespace sap.capire.parkingapp;
using { managed ,cuid} from '@sap/cds/common';

entity Offers: managed {
  key   ID: Integer;
  owner   : String;
  place   : String;
  dateStart: Date 
  dateEnd  : Date;
  description : String 
  status      : String default 'available';

}
entity Orders : managed {
  key   ID: Integer;  
  OrderNo  : String @title:'Order Number'; //> readable key
  offer    :  Association to Offers 
  beneficiary : String 

}

service.cds

using { sap.capire.parkingapp as my } from '../db/schema';
service CatalogService @(path:'/browse') {

    @odata.draft.enabled
    entity Offers as SELECT from my.Offers excluding { createdBy, modifiedBy } 

    entity Orders as projection on my.Orders;
    
    
}

create the FE List report/Object page project on SAP WebIDE and I added the Local UI annotations to the project using annotation modeler extension , I get the result below :

When I want to create a new entity (offer) I get this issue like is shown in the developer tools below :

I tried to test the post request to my Odata service on Postman and it is working , I could get my new inserted entity in the Fiori list report page when I load it but they are inserted on draft like is shown in the first picture (list report ) .But when I go to the details(object page ) of that new entity it is a draft when I try to save it I get the error below :

Please how can I handle this issue to perform CRUD operation on my entity . Any pointers, suggestions, links would be helpful .

Thank you,

Mariam

Attachments

ali-1.png (133.7 kB)
ali2.png (105.1 kB)
omg.png (314.3 kB)
draft.png (110.6 kB)