为预订子实体创建行为池
ABAP RESTful 应用程序编程模型 › 开发 › 开发应用程序 › 开发非托管事务应用 › 定义并实施业务对象行为 › 实施业务对象的行为 › 为预订子实体创建行为池
过程 1:创建行为池 /DMO/BP_BOOKING_U
要启动用于创建行为实施的向导工具,请执行以下操作:
将以下语法添加到差旅实体的实体行为的 部分中的 行为定义。
implementation in class /dmo/bp_booking_u unique
通过行为定义,可以快速创建与行为定义中描述的行为相对应的行为池。按照快速修复启动用于创建 ABAP 类的向导。
结果:预订子实体的行为池
生成的行为池(在本例中为 /DMO/CL_BOOKING_U) 为您提供扩展 FOR BEHAVIOR OF。

过程 2:定义对应于行为模型的局部类的框架
根据行为定义中的声明 /DMO/I_TRAVEL_U,行为实施为预订实体提供局部类的框架:
展开以下代码示例以查看 /dmo/bp_booking_u 局部类模板的源代码。
示例代码
CLASS lhc_booking DEFINITION INHERITING FROM cl_abap_behavior_handler.
PRIVATE SECTION.
TYPES tt_booking_failed TYPE TABLE FOR FAILED /dmo/i_booking_u.
TYPES tt_booking_reported TYPE TABLE FOR REPORTED /dmo/i_booking_u.
TYPES tt_bookingsupplement_failed TYPE TABLE FOR FAILED /dmo/i_bookingsupplement_u.
TYPES tt_bookingsupplement_reported TYPE TABLE FOR REPORTED /dmo/i_bookingsupplement_u.
METHODS update FOR MODIFY
IMPORTING entities FOR UPDATE booking.
METHODS delete FOR MODIFY
IMPORTING keys FOR DELETE booking.
METHODS read FOR READ
IMPORTING keys FOR READ booking RESULT result.
METHODS rba_Booksupplement FOR READ
IMPORTING keys_rba FOR READ booking\_Booksupplement FULL result_requested RESULT result LINK association_links.
METHODS rba_Travel FOR READ
IMPORTING keys_rba FOR READ booking\_Travel FULL result_requested RESULT result LINK association_links.
METHODS cba_Booksupplement FOR MODIFY
IMPORTING entities_cba FOR CREATE booking\_Booksupplement.
METHODS map_messages
IMPORTING
cid TYPE string OPTIONAL
travel_id TYPE /dmo/travel_id OPTIONAL
booking_id TYPE /dmo/booking_id OPTIONAL
messages TYPE /dmo/t_message
EXPORTING
failed_added TYPE abap_bool
CHANGING
failed TYPE tt_booking_failed
reported TYPE tt_booking_reported.
METHODS map_messages_assoc_to_booksupp
IMPORTING
cid TYPE string OPTIONAL
travel_id TYPE /dmo/travel_id OPTIONAL
booking_id TYPE /dmo/booking_id OPTIONAL
booking_supplement_id TYPE /dmo/booking_supplement_id OPTIONAL
is_dependend TYPE abap_bool DEFAULT abap_false
messages TYPE /dmo/t_message
EXPORTING
failed_added TYPE abap_bool
CHANGING
failed TYPE tt_bookingsupplement_failed
reported TYPE tt_bookingsupplement_reported.
ENDCLASS.
ENDCLASS.
CLASS lhc_booking IMPLEMENTATION.
...
ENDCLASS.
来源:SAP Help Portal · 2025 FPS02 (Oct 2026) · 中文为 SAP 官方机器翻译
← 实施动态操作控制 · 实施预订实例的 UPDATE、DELETE 和 READ 操作 →