Action, Operation, and Field Control

Dynamic Feature Control in RAP
With feature control, you can add information to the service on how data has to be displayed for consumption in an SAP Fiori UI. Feature control can relate to actions (action control), standard operations (operation control), and fields (field control).
Action Control is the dynamic enabling and disabling of actions. The decision can either depend on the data of the affected instance (instance feature control) or not (global feature control). For example, it should not be possible to cancel an already delivered order.
Operation Control means the enabling and disabling of standard operations create, update, and delete on node instances. In the case of global feature control, the respective operation is dynamically enabled or disabled for all instances of the entity, independent of its data. In the case of instance feature control, the availability of an operation depends on the data. For example, it should not be possible to edit an order or to add new items to it once the order is already being processed.
Field Control means the classification of node attributes as read-only or mandatory. In the case of static field control, the property is the same for all instances of the node, independent of its data or the change operation. In the case of dynamic field control, the property depends on the data or the operation. For example, a certain field could be mandatory when creating a new instance but should be read-only afterwards.
Feature Control Definition

Addition FEATURES : INSTANCE
Dynamic feature control on instance level is enabled by adding the option (features: instance) to the respective statement in the behavior definition body. The option is available for statements update, delete, action, and field.
Instance Feature Handler Method

Creating the Feature Handler Method
If the behavior definition already contains (features : instance) options, the quick fix for creating the behavior pool will automatically create the feature control implementation method in the local handler class.
If the behavior pool already exists when you add the first ( features : instance ) option, you can use a quick fix to add the missing method to the local handler class. To invoke the quick fix, place the cursor on keyword feature and press Ctrl + 1.

Implementing the Feature Handler Method
The logic of dynamic feature control is implemented in a local handler class as part of the behavior pool. This local class inherits from the base handler class CL_ABAP_BEHAVIOR_HANDLER.
The signature of the feature control method is typed using the keyword FOR FEATURES followed by the import parameters. The type of importing parameter keys is an internal table containing the keys of the instances the feature control will be executed on. Importing parameter requested_features is a structure of Boolean-like components that reflect which elements (actions, standard operations, fields) of the entity are requested for dynamic feature control by the consumer. You can improve the performance of the handler method by evaluating this parameter and only executing the logic for the requested elements.
Exporting the parameter result is used to return the feature control values. The table-like parameter includes, besides the key fields, all actions, standard operations, and fields of the entity, for which the feature control was defined in the behavior definition.
Although not visible in the method definition, the feature handler method also has a response parameters failed and reported for indicating failures and returning messages
Response Parameter RESULT

Result of Feature Handler Method