ABAP for Cloud Development
AS ABAP Release 914, ©Copyright 2024 SAP SE. All rights reserved.
ABAP - Keyword Documentation → ABAP RAP Business Objects → RAP - Behavior Definitions → RAP - BDL for Behavior Definitions → RAP - Interface Behavior Definition →
RAP - Behavior Definition Header, Interface BDEF
Syntax
interface;
extensible;
with managed instance filter;
use draft;
use side effects;
with privileged mode;
foreign entity EntityName;
EntityBehaviorDefinition1 ,EntityBehaviorDefinition2 , ...
...
Description
The RAP behavior definition header of an interface BDEF can project certain elements from its base BO. Defining new elements is not possible. All possible elements are listed below. The implementation type is mandatory and all other attributes are optional.
interface
: An interface BDEF must have the implementation typeinterface
and it must be based on a CDS transactional interface.extensible
: If specified, BDEF extensions are allowed. As a prerequisite, the projected BDEF must define at least one entity asextensible
.with managed instance filter
: Optional addition. If specified, theWHERE
condition of the underlying CDS transactional interface is evaluated when the BDEF is accessed with ABAP EML or OData requests from Web clients. If this addition is not specified, theWHERE
clause is ignored. For further details, see topic RAP -with managed instance filter
.use draft
: The draft concept can be reused from the base BO.- For details on the draft concept, see topic RAP -
with draft
. - For details on the reuse, see topic RAP BDL - use.
use side effects
: RAP side effects can be reused from the base BO.- For details on side effects, see topic RAP -
side effects
. - For details on the reuse, see topic RAP -
use
, Projection and Interface BDEF. with privileged mode
: BDEF privileged mode can be used. As a prerequisite, it must be specified in the projected BO. For details, see topic RAP -with privileged mode
.foreign entity
: Defines a RAP foreign entity, this means, an entity which is not part of the BO structure as component for the response structures, thus enabling message mapping for other BOs.
The behavior definition header is followed by one or more entity behavior definition(s) EntityBehaviorDefinition1
, EntityBehaviorDefinition2
, ... that start with define behavior for
.
Restrictions
- An ABAP behavior pool must not be specified. The syntax
implementation in class
is not supported. An interface BDEF is a BDEF type without runtime handler. - BDEF strict mode cannot be defined explicitly. Strict checks are automatically applied.
Example
The following example shows an interface BDEF. The projected BO is DEMO_RAP_UNMANAGED_DRAFT_ROOT
. The interface BDEF reuses draft handling and standard operations from the underlying BO. It also defines a foreign entity and excludes a field from the BDEF derived types.
interface;
use draft;
foreign entity demo_cds_validation;
define behavior for DEMO_RAP_INTERFACE_DRAFT alias Root
use etag
{
use create;
use update;
use delete;
use action Activate;
use action Discard;
use action Edit;
use action Resume;
use action Prepare;
field(suppress) DataFieldRoot;
}