Show TOC

Actions in Object Page HeaderLocate this document in the navigation structure

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:

Figure 1: Object Page: Actions Defined for the EntitySet
Edit and Delete Buttons
The Edit and Delete buttons will be displayed as shown above if the following conditions are met:
  • Edit button: sap:updatable is not set to false

  • Delete button: sap:deletable is not set to false
Note

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.

Show or Hide Edit and Delete Buttons (Using updatable-path and deletable-path 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.

Note
  • 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.

Code Samples

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

The code sample below shows how to set up your annotation to display or hide the Edit button, based on the value of the Updatable_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.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.