SAP-samples / abap-platform-rap-opensap

Samples for the openSAP course "Building Apps with the ABAP RESTful Application Programming model (RAP)."
https://open.sap.com/courses/cp13
Apache License 2.0
437 stars 235 forks source link

WEEK 3 UNIT 3: Cannot see Edit and Delete Button #28

Closed ajayrawatsap closed 3 years ago

ajayrawatsap commented 3 years ago

I am following the link to add the behavior definition .

On Fiori Preview I cannot see the Edit and Create button. The data is getting displayed correctly. I have also tried creating new service Binding, Deleted the Cache, Changed the Default Browser to Edge and Chrome, but its not working .

I am using ABAP Trial Account f or SAP BTP

The Behavior Definition for both Entity View and Projection view is created as below

managed; // implementation in class zbp_i_rap_travel unique;

define behavior for ZI_Rap_Travel alias Travel
persistent table ZRAP_ATRAV
lock master
//authorization master ( instance )
etag master LocalLastChangedAt
{
  create;
  update;
  delete;
  association _Booking { create; }
  field (numbering : managed, readonly) TravelUUID;

   mapping for zrap_atrav
  {
    TravelUUID         = travel_uuid;
    TravelID           = travel_id;
    AgencyID           = agency_id;
    CustomerID         = customer_id;
    BeginDate          = begin_date;
    EndDate            = end_date;
    BookingFee         = booking_fee;
    TotalPrice         = total_price;
    CurrencyCode       = currency_code;
    Description        = description;
    TravelStatus       = overall_status;
    CreatedBy          = created_by;
    CreatedAt          = created_at;
    LastChangedBy      = last_changed_by;
    LastChangedAt      = last_changed_at;
    LocalLastChangedAt = local_last_changed_at;
  }
}

define behavior for ZI_RAP_Booking alias Booking
persistent table ZRAP_ABOOK
lock dependent by _Travel
//authorization dependent by <association>
etag master LocalLastChangedAt
{
  update;
  delete;
  association _Travel;
  field (numbering : managed, readonly) BookingUUID;
  field (readonly) TravelUUID;

  mapping for zrap_abook
  {
    BookingUUID        = booking_uuid;
    TravelUUID         = travel_uuid;
    BookingID          = booking_id;
    BookingDate        = booking_date;
    CustomerID         = customer_id;
    CarrierID          = carrier_id;
    ConnectionID       = connection_id;
    FlightDate         = flight_date;
    FlightPrice        = flight_price;
    CurrencyCode       = currency_code;
    CreatedBy          = created_by;
    LastChangedBy      = last_changed_by;
    LocalLastChangedAt = local_last_changed_at;
  }

}

For Projection View

projection;

define behavior for ZC_RAP_Travel alias Travel
use etag
{
  use create;
  use update;
  use delete;

  use association _Booking { create; }
}

define behavior for ZC_RAP_Booking alias Booking
use etag
{
  use update;
  use delete;

  use association _Travel;
}
ajayrawatsap commented 3 years ago

For benefit of others the issue was resolved after I completed the Week3- UInit5 where we a ENHANCING THE BUSINESS OBJECT BEHAVIOR WITH APP-SPECIFIC LOGIC.

I am not sure if it is expected behavior but it would be good if the documentation can be updated to reflect this