Show TOC

Actions in List Report ViewLocate this document in the navigation structure

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.

Actions in the Toolbar

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

The table below describes how to set up your annotations so that certain common functions are rendered in the toolbar:

Action

Setting

Comments

Create (+)

sap:creatable="true" for the root entity set

The Create feature is enabled by default, as the entity set is already creatable.

Delete

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

The code sample below shows how to set up your annotation to enable or disable 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>

CDS Annotations for 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.

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:

Figure 1: List Report: Annotation DataFieldForAction for Defining Custom Actions
Sample Code
<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>
Actions for Line Items

For information about setting up annotations for actions within a line item of the list report, see Line Item Actions in Tables.

Confirmation Popover

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>