Zum Hauptinhalt springen

17. Entwurfs-Funktionen implementieren

  • Die Behavior Definition ZR_TRAVELTP um Entwurfs-Funktionen erweitern
  • Eine Entwurfstabelle ZTRAVEL_D generieren lassen
  • Eine Entwurfstabelle ZBOOKING_D generieren lassen
  • Die Behavior Projection ZC_TRAVELTP um Entwurfs-Funktionen erweitern
  • Das Service Binding ZUI_TRAVEL_O4 erstellen
  • Das Service Binding ZUI_TRAVEL_O2 löschen

Behavior Definition ZR_TRAVELTP

managed implementation in class zbp_traveltp unique;
strict ( 2 );
with draft;

define behavior for ZR_TravelTP alias Travel
persistent table ztravel_a
draft table ztravel_d
lock master
total etag LastChangedAt
authorization master ( instance )
//etag master <field_name>
{
create;
update;
delete;

association _Bookings { create; with draft; }

static action ShowTestMessage;
action CancelTravel result [1] $self;
action MaintainBookingFee parameter ZA_BookingFee result [1] $self;

draft action Activate optimized;
draft action Discard;
draft action Edit;
draft determine action Prepare
{
validation ValidateDates;
validation ValidateCustomer;
validation ValidateAgency;
}
draft action Resume;

validation ValidateDates on save { create; }
validation ValidateCustomer on save { create; }
validation ValidateAgency on save { create; }

determination DetermineStatus on modify { create; }
determination DetermineTravelId on modify { create; }

field ( readonly, numbering : managed ) TravelUuid;
field ( mandatory : create ) AgencyId, BeginDate, CustomerId, Description, EndDate;
field ( readonly : update ) AgencyId, BeginDate, CustomerId, Description, EndDate;
field ( readonly ) CreatedAt, CreatedBy, LastChangedAt, LastChangedBy, Status, TravelId;

mapping for ztravel_a corresponding
{
AgencyId = agency_id;
BeginDate = begin_date;
BookingFee = booking_fee;
CreatedAt = created_at;
CreatedBy = created_by;
CurrencyCode = currency_code;
CustomerId = customer_id;
Description = description;
EndDate = end_date;
LastChangedAt = last_changed_at;
LastChangedBy = last_changed_by;
Status = status;
TotalPrice = total_price;
TravelId = travel_id;
TravelUuid = travel_uuid;
}
}

define behavior for ZR_BookingTP alias Booking
persistent table zbooking_a
lock dependent by _Travel
draft table zbooking_d
authorization dependent by _Travel
//etag master <field_name>
{
update;
delete;

association _Travel { with draft; }

field ( readonly, numbering : managed ) BookingUuid;
field ( readonly ) TravelUuid;

mapping for zbooking_a corresponding
{
BookingDate = booking_Date;
BookingId = booking_id;
BookingUuid = booking_uuid;
CarrierId = carrier_id;
ConnectionId = connection_id;
CurrencyCode = currency_code;
FlightDate = flight_date;
FlightPrice = flight_price;
TravelUuid = Travel_uuid;
}
}

Behavior Projection ZC_TRAVELTP

projection;
strict ( 2 );
use draft;

define behavior for ZC_TravelTP alias Travel
{
use create;
use update;
use delete;

use association _Bookings { create; with draft; }

use action ShowTestMessage;
use action CancelTravel;
use action MaintainBookingFee;

use action Activate;
use action Edit;
use action Discard;
use action Prepare;
use action Resume;
}

define behavior for ZC_BookingTP alias Booking
{
use update;
use delete;

use association _Travel { with draft; }
}

Service Binding ZUI_TRAVEL_O4

  • Service Definition: ZUI_TRAVEL
  • Binding Type: OData V4 - UI