[sap fiori rap cds--behavior]

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;
}
相关推荐
Shi_haoliu2 小时前
openClaw源码部署-linux
前端·python·ai·openclaw
程序员小寒3 小时前
前端性能优化之白屏、卡顿指标和网络环境采集篇
前端·javascript·网络·性能优化
烛阴3 小时前
Claude CLI AskUserQuestion 工具详解:让 AI 开口问你
前端·claude
wal13145203 小时前
OpenClaw教程(九)—— 彻底告别!OpenClaw 卸载不残留指南
前端·网络·人工智能·chrome·安全·openclaw
mon_star°4 小时前
在TypeScript中,接口MenuItem定义中,为什么有的属性带问号?,有的不带呢?
前端
牛奶4 小时前
分享一个开源项目,让 AI 辅助开发真正高效起来
前端·人工智能·全栈
次顶级5 小时前
表单多文件上传和其他参数处理
前端·javascript·html
why技术5 小时前
我拿到了腾讯QClaw的内测码,然后沉默了。
前端·后端
谪星·阿凯6 小时前
XSS漏洞解析博客
前端·web安全·xss