If desired, you can enable certain common actions specific to your use case for list report items. You can choose to display the actions in either the toolbar or within a specific column for line items.
You may wish to display actions in the toolbar to allow users to perform an action for one or more lines in the table.
Common Functions in Toolbar
sap:creatable="true" for the root entity set
|The Create feature is enabled by default, as the entity set is already creatable.|
sap:deletable="true" for the root entity set
|The Delete feature is enabled by default, as the entity set is already deletable. Note that if you wish to specify conditions for deletion (using the deletable-path annotation), you must ensure that the setting sap:deletable is not present.|
Enable or Disable Delete Button (Using deletable-path Annotations)
You can choose to enable or disable the Delete button on the list report based on certain conditions specified in the back-end system. For example, you may wish to disable deletion for a sales order that has already been paid. In this case, if a user selects an item that cannot be deleted, the Delete button will be disabled. In addition, if the user navigates from this item in the list report to the object page, the Delete button will be hidden.
Within your annotation, you set the deletable-path 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 button is enabled; if it is false, it is disabled. Note that if you wish to use the deletable-path annotation to specify conditions for deletion, you must you must ensure that the setting sap:deletable is not present in your annotations.
Sample Code: deletable-path
<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>
CDS Annotations for deletable-path
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.
Custom Actions in Toolbar (Specify Text)
To specify a text for your action, use the com.sap.vocabularies.UI.v1.DataFieldForAction property and specify the text to display. The example below shows how to display an action to create a copy of the list item in the toolbar:
<Annotation Term="UI.LineItem"> <Collection> <Record Type="UI.DataFieldForAction"> <PropertyValue Property="Label" String="Copy"/> <PropertyValue Property="Action" String="SEPMRA_PROD_MAN.SEPMRA_PROD_MAN_Entities/SEPMRA_C_PD_ProductCopy"/> </Record> <Collection> <Record Type="UI.DataField"> ... </Collection> </Annotation>
For information about setting up annotations for actions within a line item of the list report, see Line Item Actions in Tables.
If you wish to display a popover when the user triggers the action, add the IfActionCritical annotation as shown below:
<Annotations Target="GWSAMPLE_BASIC.GWSAMPLE_BASIC_Entities/RegenerateAllData"> <Annotation Term="com.sap.vocabularies.Common.v1.IsActionCritical" Bool="true"/> </Annotations>