We recommend that you use the inline creation mode or empty row mode only for tables that don't have a large number of columns. For complex tables, use create page instead.
The behavior of the available modes is as follows:
Inline Creation Mode: When adding new entries to a table section, a new line is created and the fields can be modified inline without triggering automatic navigation to the item's object page. When a new entry is created, the line is highlighted in blue. This highlight disappears once the data is saved.
By default, a new entry is created and the system automatically navigates to the item's object page.
Empty Row Mode: When an end user begins adding data to a field in an existing empty row, a new empty row is automatically created. In a responsive table, the empty row appears at the top, while in a grid table, it appears at the bottom. There is no corresponding entry in the draft table for the empty row.
The automatically added empty row is removed if the end user doesn't add any data. It isn't required to manually remove the empty row.
The empty row mode has the following features:
The row actions, such as the navigation indicator using a chevron and inline deletion, are hidden in the empty row.
Sorting and grouping isn't applicable for the empty row, as it doesn't exist in a back-end table.
In a responsive table, the Create button is hidden.
In a grid table, the Create button is visible. When you select Create in the grid table toolbar, the table scrolls to the bottom of the table to display the empty row and automatically sets the focus on the first editable field of the empty row.
You can see the newly created record at the top of the table. If a user repeatedly clicks the Create button, the "latest new" record is moved to the top of the new records.
Support of Required Fields
The empty row mode also supports required fields. These fields are declared using Capabilities.InsertRestrictions.RequiredProperties
.
XML Annotation
<Annotations Target="com.c_salesordermanage_sd.SalesOrderManage/_Item"> <Annotation Term="Capabilities.InsertRestrictions"> <Record Type="Capabilities.InsertRestrictionsType"> <PropertyValue Property="RequiredProperties"> <Collection> <PropertyPath>RequestedQuantity</PropertyPath> <PropertyPath>Material</PropertyPath> </Collection> </PropertyValue> </Record> </Annotation> </Annotations>
Support of Default Values
If you want to set default values for an empty row, use a DefaultValuesFunction
.
DefaultValuesFunction
for create
entity
<FunctionImport Name="GetDefaultsForRoot" ReturnType="cds_zrc_dv_defaultvalues.ZRC_DV_A_Create" m:HttpMethod="GET"/> <Annotations xmlns=http://docs.oasis-open.org/odata/ns/edm Target="cds_zrc_dv_defaultvalues.cds_zrc_dv_defaultvalues_Entities/Root"> <Annotation Term="com.sap.vocabularies.Common.v1.DefaultValuesFunction" String="GetDefaultsForRoot"/> </Annotations>
For more information, see Prefilling Fields When Creating a New Entity and Prefilling Fields When Creating a New Entity Using an Extension Point.
DefaultValuesFunction
for navigation property/item
create
<FunctionImport Name="GetDefaultsForItem" ReturnType="cds_zrc_dv_defaultvalues.ZRC_DV_A_Create" m:HttpMethod="GET" sap:action-for="cds_zrc_dv_defaultvalues.RootType"> <Parameter Name="UUID" Type="Edm.Guid" Mode="In"/> </FunctionImport> <Annotations xmlns=http://docs.oasis-open.org/odata/ns/edm Target="cds_zrc_dv_defaultvalues.RootType/to_Item"> <Annotation Term="com.sap.vocabularies.Common.v1.DefaultValuesFunction" String="GetDefaultsForItem"/> </Annotations>
Recalculating Default Values
If you're using a property that influences the result of the DefaultValuesFunction
, you must annotate a side effect for each table that uses the
DefaultValuesFunction
. Doing so ensures that the existing empty row always gets the new calculated value. In the side effects, use the
navigation property that represents the table as the target entity.
SideEffects #TableIsRefreshed: { SourceProperties: [CustomerNumber], TargetEntities : [_Item] }
XML Annotation
<Annotation Term="Common.SideEffects" Qualifier=" TableIsRefreshed "> <Record Type="Common.SideEffectsType"> <PropertyValue Property="SourceProperties"> <Collection> <PropertyPath>CustomerNumber</PropertyPath> </Collection> </PropertyValue> <PropertyValue Property="TargetEntities"> <Collection> <NavigationPropertyPath>_Item</NavigationPropertyPath> </Collection> </Record> </Annotation>
You can make the object page tables insertable or not insertable using the InsertRestrictions
annotation. For
more information, see Adding Actions to Tables.
If you've defined an ID for the reference facet of your table, use this ID instead of the generated one, for example, to_ProductText::com.sap.vocabularies.UI.v1.LineItem. For more information, see Defining and Adapting Sections.
For apps based on SAP NetWeaver 7.51 SP00 or lower, the following restriction applies: table filters in inline creation mode may not work properly, and the filtered data may not match the filter parameters. This only applies to apps that use draft handling.
com.sap.vocabularies.Common.v1.DefaultValuesFunction
annotation is defined in the entity set that belongs to the table with which it's configured. For more information, see Prefilling Fields Using the DefaultValuesFunction.