将操作定义为行为定义的一部分
ABAP RESTful 应用程序编程模型 › 开发 › 开发应用程序 › 开发托管事务应用 › 开发业务逻辑 › 开发操作 › 将操作定义为行为定义的一部分
操作在行为定义中定义。
根据下面的代码块,将以下操作添加到行为定义 /DMO/I_TRAVEL_M。
acceptTravel、rejectTravel 和 copyTravel 这三个操作都具有类似的语法:它们没有输入参数,并且输出参数是为其执行操作的相同实体。
操作 ReCalcTotalPrice 是不含结果参数的内部操作。
define behavior for /DMO/I_Travel_M alias travel
implementation in class /DMO/BP_TRAVEL_M unique
...
{
// instance actions
action acceptTravel result [1] $self;
action rejectTravel result [1] $self;
// instance factory action for copying travel instances
factory action copyTravel [1];
// internal action that is called by determinations
internal action ReCalcTotalPrice;
...
}
define behavior for /DMO/I_Booking_M alias booking
implementation in class /DMO/BP_BOOKING_M unique
...
{...
// No actions defined for bookings
}
define behavior for /DMO/I_BookSuppl_M alias booksuppl
implementation in class /DMO/BP_BOOKINGSUPPLEMENT_M unique
...
{...
// No actions defined for booking supplements
}
来源:SAP Help Portal · 2025 FPS02 (Oct 2026) · 中文为 SAP 官方机器翻译