If desired, you can enable actions within your object page header.
All data fields with com.sap.vocabularies.UI.v1.DataFieldForAction are interpreted as actions, and the system renders a button within the header displaying the text of the data field label.
Data fields for actions that you annotate with high importance are displayed to the left of the Edit/Delete buttons, and those without high importance are displayed to the right. In addition to importance, you must specify the action for the data field and implement the action handling in the OData service (DPC: execute_action), as shown below for the Copy button:
Edit button: sap:updatable is not set to false
If you wish to specify conditions for deletion or updates (using the deletable-path or updatable-path annotation), you must ensure that the setting sap:deletable or sap:updatable is not present in your annotations.
You can choose to display or hide the Delete or Edit button on the object page based on certain conditions in your back-end system. For example, you may wish to disable editing or deletion for a sales order that has already been paid.
Within your annotation, you set the deletable-path (for the Delete button) or updatable-path (for the Edit button) to point to a particular property of an object (entity) in the back-end system that has a value of either true or false. If the value of this property is true, the Delete or Edit button is displayed; if it is false, it is hidden.
This is done in conjunction with the deletable-path annotation for the list report.
If you wish to specify conditions for deletion or updates (using the deletable-path or updatable-path annotation), you must ensure that the setting sap:deletable or sap:updatable is not present in your annotations.
deletable-path
The code sample below shows how to set up your annotation to display or hide the Delete button, based on the value of the Delete_mc property in the back-end system.
<Annotations Target="STTA_PROD_MAN.STTA_PROD_MAN_Entities/STTA_C_MP_Product"> <Annotation Term=" Org.OData.Capabilities.V1.DeleteRestrictions"> <Record> <PropertyValue Property="Deletable" Path="Delete_mc"/> </Record> </Annotation> </Annotations>
updatable-path
<Annotations Target="STTA_PROD_MAN.STTA_PROD_MAN_Entities/STTA_C_MP_Product"> <Annotation Term="Org.OData.Capabilities.V1.UpdateRestrictions"> <Record> <PropertyValue Property="Updatable" Path="Updatable_mc"/> </Record> </Annotation> </Annotations>
CDS Annotations
deletable-path
@ObjectModel.deleteEnabled: 'EXTERNAL_CALCULATION'
If you annotate @ObjectModel.deleteEnabled with 'EXTERNAL_CALCULATION', a new property (Delete_mc) will be generated for your entity. This is a calculated property and does not exist in any database.
For more information, see the information for ObjectModel.deleteEnabled in ObjectModel Annotations.
updatable-path
@ObjectModel.updateEnabled: 'EXTERNAL_CALCULATION'
If you annotate @ObjectModel.updateEnabled with 'EXTERNAL_CALCULATION', a new property (Update_mc) will be generated for your entity. This is a calculated property and does not exist in any database.
For more information, see the information for ObjectModel.updateEnabled in ObjectModel Annotations.