SAP Fiori elements provides
two generic actions (Create and Delete)
that can be rendered in the toolbar based on metadata properties
sap:creatable=true
and sap:deletable=true
of the
entity set.
You can control the Insert
capability for the related entities, that is
the enablement of the Create button, using the following
options:
NavigationRestrictions
The system gives priority to the
Org.OData.Capabilities.V1.NavigationRestrictions
of the parent entity set if it is defined, and the
InsertRestrictions
provided directly at the table entity set
level (Option 2 below) is ignored. Depending on the value of the
Insertable
property of InsertRestrictions
, the
related (table) entity set is made insertable or not insertable.
If Insertable
is set as true
, the related
entity set is insertable.
If Insertable
is set as false
, the related
entity set isn't insertable.
XML Annotation
<Annotations Target="STTA_PROD_MAN.STTA_PROD_MAN_Entities/STTA_C_MP_Product"> <Annotation Term="Capabilities.NavigationRestrictions"> <Record> <PropertyValue Property="RestrictedProperties"> <Collection> <Record> <PropertyValue Property="NavigationProperty" NavigationPropertyPath="to_ProductText"/> <PropertyValue Property="InsertRestrictions"> <Record> <PropertyValue Property="Insertable" Bool="true"/> <!--Example with Boolean value for InsertRestriction--> <!-- <PropertyValue Property="Insertable" Path="Insertable"/>--> <!--Example with path for InsertRestriction--> </Record> </PropertyValue> </Record> </Collection> </PropertyValue> </Record> </Annotation> </Annotation>
ABAP CDS Annotation
No ABAP CDS annotation is required, since the setting is made according to the modeling (such as create, update, or delete) in RAP BDEF (behavior definition).
define behavior for STTA_C_MP_Product { create; delete; update; association _ProductText { create; } };
InsertRestrictions
If Insertable
is set as true
, the related
entity set is insertable.
If Insertable
is set as false
, the related
entity set isn't insertable.
XML Annotation
<Annotations Target="STTA_PROD_MAN.STTA_PROD_MAN_Entities/STTA_C_MP_ProductText"> <Annotation Term="Capabilities.InsertRestrictions"> <Record> <PropertyValue Property="Insertable" Bool="true" /> <!--Example with Boolean value for InsertRestriction--> </Record> </Annotation> </Annotations>
ABAP CDS Annotation
No ABAP CDS annotation is required, since the setting is made according to the modeling (such as create, update, or delete) in RAP BDEF (behavior definition).
CAP CDS Annotation
annotate STTA_PROD_MAN.STTA_C_MP_ProductText with @( Capabilities.InsertRestrictions : { Insertable : true, } );
For more information, see Enabling Inline Creation Mode or Empty Row Mode for Table Entries.
The Delete button can be seen as an action on the table and it's disabled until a selection is made.
DeleteRestrictions
also supports path-based values.
The Delete button is enabled by default if
DeleteRestrictions
isn't provided.
XML Annotation
<Annotations Target="SAP__self.Container/SalesOrderManage"> <Annotation Term="SAP__capabilities.DeleteRestrictions"> <Record> <PropertyValue Property="Deletable" Bool="false"/> </Record> </Annotation> </Annotations>
ABAP CDS Annotation
No ABAP CDS annotation is required, since the setting is made according to the modeling (such as create, update, or delete) in RAP BDEF (behavior definition).
CAP CDS Annotation
annotate SAP__self.SalesOrderManage with { SAP__capabilities.DeleteRestrictions : { Deletable : false } };
The Delete action can't be performed for any of the selected records if the deletion of one of the selected records fails in the back end. So the Delete action either works for all records or for none.
Tables can also show application-configured actions. These can either be custom actions configured in the manifest.json
,
or can come from annotations.
Custom Actions (manifest.json
)
Applications can define custom table toolbar actions using enhancements to the
manifest.json
file. For more information, see the corresponding
sections in Adding Custom Actions Using Extension Points.
Annotation-Based Actions
The following types of actions are supported:
Actions that trigger a back-end call through the OData service, for example
Approve or Unblock, represented
by the complex type DataFieldForAction
.
DataFieldForIntentBasedNavigation
. For more information, see Navigation from an App (Outbound Navigation).Annotation-based actions can be inline actions. Inline actions are used to trigger actions directly for a single table row. Such an action
shows up within the table control as a separate column. To set an action as an inline action, set the Inline
property to
true
. The line item actions are then displayed as shown in the following screenshot:
To specify a text for your action, use the
com.sap.vocabularies.UI.v1.DataFieldForAction
property and
specify the text to be displayed.
For more information about adding a button triggering external navigation, see Navigation from an App (Outbound Navigation).
For more information about context-dependent and context-independent actions, see Actions.
The following code sample shows how to create your annotations for line item actions.
Note that the UI.LineItem
vocabulary term is used to define the
columns for the table.
UI.LineItem
XML Annotation
<Annotation Term="UI.LineItem"> <Collection> <Record Type="UI.DataFieldForAction"> <PropertyValue Property="Label" String="Copy with new Supplier"/> <PropertyValue Property="Action" String="STTA_PROD_MAN.STTA_PROD_MAN_Entities/STTA_C_MP_ProductCopywithparams"/> <PropertyValue Property="InvocationGrouping" EnumMember="UI.OperationGroupingType/Isolated"/> </Record> <Record Type="UI.DataFieldForAction"> <PropertyValue Property="Label" String="Activate"/> <PropertyValue Property="Action" String="STTA_PROD_MAN.STTA_PROD_MAN_Entities/STTA_C_MP_ProductActivation"/> <PropertyValue Property="InvocationGrouping" EnumMember="UI.OperationGroupingType/ChangeSet"/> </Record> <Record Type="UI.DataField"> <PropertyValue Property="Value" Path="Product"/> <Annotation Term="UI.Importance" EnumMember="UI.ImportanceType/High"/> </Record> <Record Type="UI.DataField"> <PropertyValue Property="Value" Path="ProductCategory"/> <Annotation Term="UI.Importance" EnumMember="UI.ImportanceType/High"/> </Record> <Record Type="UI.DataField"> <PropertyValue Property="Value" Path="to_Supplier/CompanyName"/> <Annotation Term="UI.Importance" EnumMember="UI.ImportanceType/High"/> </Record> <Record Type="UI.DataField"> <PropertyValue Property="Criticality" Path="to_StockAvailability/StockAvailability"/> <PropertyValue Property="Value" Path="to_StockAvailability/StockAvailability"/> <Annotation Term="UI.Importance" EnumMember="UI.ImportanceType/High"/> </Record> <Record Type="UI.DataField"> <PropertyValue Property="Value" Path="Price"/> <Annotation Term="UI.Importance" EnumMember="UI.ImportanceType/High"/> </Record> <Record Type="UI.DataFieldForAction"> <PropertyValue Property="Label" String="Copy"/> <PropertyValue Property="Action" String="STTA_PROD_MAN.STTA_PROD_MAN_Entities/STTA_C_MP_ProductCopy"/> <PropertyValue Property="Inline" Bool="true"/> <PropertyValue Property="InvocationGrouping" EnumMember="UI.OperationGroupingType/Isolated"/> </Record> <Record Type="UI.DataFieldForIntentBasedNavigation"> <PropertyValue Property="Label" String="Manage Products (ST)"/> <PropertyValue Property="SemanticObject" String="EPMProduct"/> <PropertyValue Property="Action" String="manage_st"/> <PropertyValue Property="Inline" Bool="true"/> </Record> <Record Type="UI.DataFieldWithIntentBasedNavigation"> < PropertyValue Property ="Label" String ="Weight (with IBN)" /> < PropertyValue Property ="Action" String ="manage_st_test" /> <PropertyValue Property="Value" Path="Weight"/> <PropertyValue Property="SemanticObject" String="EPMProduct" /> <Annotation Term="UI.Importance" EnumMember="UI.ImportanceType/High"/> </Record> </Collection> </Annotation>
ABAP CDS Annotation
@UI.lineItem: [ { label: 'Copy with new Supplier', dataAction: 'PUSHDOWN:STTA_C_MP_ProductCopywithparams', invocationGrouping: #ISOLATED, type: #FOR_ACTION, position: 1 }, { label: 'Activate', dataAction: 'PUSHDOWN:STTA_C_MP_ProductActivation', invocationGrouping: #CHANGE_SET, type: #FOR_ACTION, position: 2 }, { label: 'Product', importance: #HIGH, value: 'PRODUCT', type: #STANDARD, position: 3 }, { label: 'Copy', dataAction: 'PUSHDOWN:STTA_C_MP_ProductCopy', invocationGrouping: #ISOLATED, type: #FOR_ACTION, position: 8 } ]
CAP CDS Annotation
UI.LineItem : [ { $Type : 'UI.DataFieldForAction', Label : 'Copy with new Supplier', Action : 'STTA_PROD_MAN.STTA_PROD_MAN_Entities/STTA_C_MP_ProductCopywithparams', InvocationGrouping : #Isolated }, { $Type : 'UI.DataFieldForAction', Label : 'Activate', Action : 'STTA_PROD_MAN.STTA_PROD_MAN_Entities/STTA_C_MP_ProductActivation', InvocationGrouping : #ChangeSet }, { $Type : 'UI.DataField', Value : Product, ![@UI.Importance] : #High }, { $Type : 'UI.DataField', Value : ProductCategory, ![@UI.Importance] : #High }, { $Type : 'UI.DataField', Value : to_Supplier.CompanyName, ![@UI.Importance] : #High }, { $Type : 'UI.DataField', Criticality : to_StockAvailability.StockAvailability, Value : to_StockAvailability.StockAvailability, ![@UI.Importance] : #High }, { $Type : 'UI.DataField', Value : Price, ![@UI.Importance] : #High }, { $Type : 'UI.DataFieldForAction', Label : 'Copy', Action : 'STTA_PROD_MAN.STTA_PROD_MAN_Entities/STTA_C_MP_ProductCopy', Inline : true, InvocationGrouping : #Isolated }, { $Type : 'UI.DataFieldForIntentBasedNavigation', Label : 'Manage Products (ST)', SemanticObject : 'EPMProduct', Action : 'manage_st', Inline : true }, { $Type : 'UI.DataFieldWithIntentBasedNavigation', Label : 'Weight (with IBN)', Value : Weight, SemanticObject : 'EPMProduct', Action : 'manage_st' } ]
In the example above, the order in which the record types are presented in the annotation determines the order in which they appear in the table columns:
For the first two record types, the DataFieldForAction
complex type doesn't contain the Inline
property, which means that the action button appears in the table toolbar. If the Inline
property is there and
set to false
, the action button is also displayed in the table toolbar.
With the next five record types, the DataField
complex type is used to define the data for a column within the
table.
With the last but two record types, the DataFieldForAction
and
DataFieldForIntentBasedNavigation
complex types are used
and contain the Inline
property, which is set to
true
. This means the action buttons appear in every row in
the appropriate column within the table.
With the last record type, the
DataFieldWithIntentBasedNavigation
complex type is used to
render the property value as a link, allowing for navigation to the semantic
object.