travel
bash
managed ;//implementation in class zbp_sc4_dv_travel_m unique;
//strict ( 2 );
define behavior for ZSC4_DV_Travel_M //alias <alias_name>
implementation in class zbp_sc4_dv_travel_m unique
persistent table ztsc4_travel_m
lock master
authorization master ( instance )
//etag master <field_name>
//draft table ZTSC4TRAVELM_D
{
create(precheck);
update;
delete;
association _Booking { create; }
mapping for ztsc4_travel_m
{
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;
OverallStatus = overall_status;
CreatedBy = created_by;
CreatedAt = created_at;
LastChangedBy = last_changed_by;
LastChangedAt = last_changed_at;
}
}
define behavior for ZSC4_DV_Booking_M //alias <alias_name>
persistent table ztsc4_booking_m
lock dependent by _Travel
authorization dependent by _Travel
//etag master <field_name>
{
update;
delete;
field ( readonly ) TravelId, BookingId;
association _Travel;
association _BookingSupplement { create; }
mapping for ztsc4_booking_m
{
TravelId = travel_id;
BookingId = booking_id;
BookingDate = booking_date;
CustomerId = customer_id;
CarrierId = carrier_id;
ConnectionId = connection_id;
FlightDate = flight_date;
FlightPrice = flight_price;
CurrencyCode = currency_code;
BookingStatus = booking_status;
LastChangedAt = last_changed_at;
}
}
define behavior for ZSC4_DV_BookSuppl_M //alias <alias_name>
persistent table ztsc4_booksuppl
lock dependent by _Travel
authorization dependent by _Travel
//etag master <field_name>
{
update;
delete;
association _Travel;
association _Booking;
mapping for ztsc4_booksuppl
{
TravelId = travel_id;
BookingId = booking_id;
BookingSupplementId = booking_supplement_id;
SupplementId = supplement_id;
Price = price;
CurrencyCode = currency_code;
LastChangedAt = last_changed_at;
}
}
Handler not implemented; Method: AUTHORITY_CHECK, Involved Entities: ZSC4_PV_TRAVEL_M
先把 implementation in class zbp_04_dv_travel_m unique; 给注释掉
然后给Travel(旅行)、Booking(预订)和Booking Supplement(预订补充项)三个实体,分别加上 implementation in class
behavior impl ---change
实现类:
bash
CLASS lhc_ZSC4_DV_Travel_M DEFINITION INHERITING FROM cl_abap_behavior_handler.
PRIVATE SECTION.
METHODS get_authorizations FOR AUTHORIZATION
IMPORTING keys REQUEST requested_authorizations FOR ZSC4_DV_Travel_M RESULT result.
ENDCLASS.
CLASS lhc_ZSC4_DV_Travel_M IMPLEMENTATION.
METHOD get_authorizations.
ENDMETHOD.
ENDCLASS.
projection--travel
bash
projection;
define behavior for ZSC4_PV_Travel_M //alias <alias_name>
{
use create;
use update;
use delete;
use association _Booking { create; }
}
define behavior for ZSC4_PV_Booking_M //alias <alias_name>
{
use update;
use delete;
use association _Travel;
use association _BookingSupplement { create; }
}
define behavior for ZSC4_PV_BOOKSUPPL_M //alias <alias_name>
{
use update;
use delete;
use association _Travel;
use association _Booking;
}