What does it do? Defines feature control> for a RAP BO operation >. With feature control, operations can be enabled or disabled. There are two variants available:
Instance feature control> Operations of a business object can be enabled or disabled depending on instance-specific criteria, for example on the value of a specific field or the value of referenced data. For example, if the status of a BO instance is set to archived>, all modifying operations can be disabled by means of instance feature control. An implementation in the RAP handler method> FOR INSTANCE FEATURES>> is mandatory.
Global feature control> Operations of a business object can be enabled or disabled globally. That means, the decision is independent of the state of the individual entity instance. An operation can be globally enabled or disabled, for example, by interpreting a feature toggle state. An implementation in the RAP handler method> FOR GLOBAL FEATURES >> is mandatory. If an operation is disabled by means of feature control, it is grayed out on the user interface of an OData application. If an external RAP BO consumer> tries to execute a disabled operation with EML, the operation fails and an entry is returned in the failed >> structure.
ABAP_FURTHER_INFO
Development guide for the ABAP RESTful Application Programming Model, section Feature Control>.
Latest notes:
Feature control cannot be used for internal operations>.
Feature control runtime checks are not evaluated for EML calls with the addition IN LOCAL MODE>>.
The EML statement GET PERMISSIONS>> can be used to get information about disabled operations.
In UI scenarios, feature control is displayed as RAP consumer hint>. NON_V5_HINTS ABAP_HINT_END
ABAP_VARIANT_1 ... features:instance>
What does it do? Instance feature control enables or disables operations depending on the state of the BO entity instance. Instance feature control can be defined for the following operations:
the standard operations> update > and delete>
operations for associations>
actions>
the draft action Edit>>.
ABAP_EXAMPLE_VX5 The following example shows a managed BDEF that defines dynamic feature control for the standard operation update>. BDEF DEMO_RAP_OPERATION_FC In the ABAP behavior pool, the following is specified: if field int_field1> > 50, then the update operation is disabled. METH BP_DEMO_RAP_OPERATION_FC(CCIMP)=>get_instance_features For the complete implementation, see BP_DEMO_RAP_OPERATION_FC======CCIMP>> The ABAP class CL_DEMO_RAP_FC_OPERATION>> uses EML> to access the RAP business object.
First, it inserts two entity instances directly onto the database using AB_SQL INSERT >:
one of them has the value '1' for field int_field1>.
the second one has value '55' for field int_field1>. Therefore, it fulfills the condition that triggers feature control: for this instance, the update operation is disabled.
An EML UPDATE>> operation is executed on both instances, which updates field int_field2>.
Using the AB_SQL SELECT>> statement, the content of the underlying database table is displayed. Result: the first entity instance is updated successfully. For the second entity instance, the update operation fails and an entry is returned in the failed> structure. The update was prevented by the dynamic feature control runtime check. IMAGE ABDOC_FC_OP.png 606 81 ABAP_EXAMPLE_END