Mentor SAP
The result parameter of the instance feature handler method is an internal table. The first columns are the key fields of the CDS entity, accessible directly or via named include %tky.

 

The columns %update and %delete only exist if feature control has been defined for the related standard operation. The type of these columns is ABP_BEHV_FLAG, with possible values if_abap_behv=>fc-o-enabled and if_abap_behv=>fc-o-disabled.

 

The column %action only exists if feature control has been defined for at least one instance action. The components of %action are named after the actions for which feature control has been defined. The type of these components is ABP_BEHV_FLAG with possible values if_abap_behv=>fc-o-enabled and if_abap_behv=>fc-o-disabled.

 

The column %field only exists if feature control has been defined for at least one field. The components of %field are named after the fields, for which feature control has been defined.

 

The type of these components is ABP_BEHV_FEATURE with possible values if_abap_behv=>fc-f-unrestricted,if_abap_behv=>fc-f-read_only, if_abap_behv=>fc-f-mandatory, and if_abap_behv=>fc-f-all.

 

Feature Control Implementation

Example: Dynamic Operation Control

 

A typical implementation of dynamic operation control starts with retrieving the data of all affected entity instances. For each instance in turn, an entry with the same key is added to the result parameter.

 

Based on the data, a decision is made about whether to allow the operation for this instance or not.

 

To disable the operation, the related component of the result parameter is filled with the value of the constant if_abap_behv=>fc-o-disabled before adding the new entry.

 

Example: Dynamic Action Control

 

A typical implementation of dynamic action control follows the same pattern as dynamic operation control. The difference is that a related component of substructure %action is filled with the value of constant if_abap_behv=>fc-o-disabled.

 

In the example, action my_action is disabled if the condition is true for an entity instance

Example: Dynamic Field Control

 

Finally, a dynamic field control implementation uses the component of substructure %field that has the same name as the affected field. In the example, field my_field set to read-only if the condition is true for an entity instance. Other values for the field behavior are unrestricted, mandatory, all.