Show TOC

SectionsLocate this document in the navigation structure

Different facets have been defined to display important information in the sections of the content area.

Sections are built using the com.sap.vocabularies.UI.v1.Facets annotations.
Note All facets are displayed on the same page. The link from the facet only navigates to the related section on the same page. The label of the facet annotation is used twice: Once for the facet in the header area and once for the title of the section.

A facet contains collection facets (UI.CollectionFacet) as well as reference facets (UI.ReferenceFacet). Collection facets are made up of a list of records that each represent a reference facet to a field group annotation. Reference facets represent a reference to a line item annotation (list on the object page).

A hierarchy level is also supported; instead of a reference facet, you can add a collection facet that consists of several reference facets. The contents of these reference facets will then be arranged underneath.

In the figure below, the collection facet for Product Information combines three reference facets. Each reference facet refers to a field group, or to an identification annotation.

Figure 1: Object Page: CollectionFacet

Further reference facets refer to identification sections, field group, contact or line items' annotations. For line items, a list is rendered.

Figure 2: Object Page: ReferenceFacets
Enabling Special Features Within Sections

To render a smart table, the section must comprise a list (indicated by com.sap.vocabularies.UI.v1.LineItem).

To render a toolbar for the table, com.sap.smartapp.UI.Action must be defined as the entity type. In this case, the com.sap.smartapp.UI.Action list is processed and a button is generated based on the label and function import information.

An Add Entry button is rendered if Org.OData.Capabilities.V1.InsertRestrictions/Insertable/Bool is set to true for the entity set.

The fields are rendered using the smart field control so the associated annotations are also used.

IDs for Collection Facets

To enable, for example, extensions, personalization, automated testing, you need to have stable IDs for views and controls. In most cases, you can derive them automatically from existing annotations. In case of collection facets, a new annotation was introduced with which you can set a stable ID. The ID should be meaningful and must be unique within the entity type. You should only use characters in camel case without spaces.

If you define your facets in an annotation file in your project, you can add the ID there directly, as in the following example:
Sample Code
<Annotation Term="UI.Facets">
	<Collection>
		<Record Type="UI.CollectionFacet">
			<PropertyValue Property="ID" String="GeneralInformation"/>
If you define the UI annotations in the MPC_EXT, you can add the ID by searching for create_record( iv_record_type = 'UI.CollectionFacet') and then, as in the following example, add the lines 3 and 4 with a meaningful ID in the data provider class of the back end system:
Sample Code
lo_collection1 = lo_annotation->create_collection( ).
lo_record2 = lo_collection1->create_record( iv_record_type = 'UI.CollectionFacet')   ##NO_TEXT.
lo_property_value3 = lo_record2->create_property( 'ID' )    ##NO_TEXT.
lo_property_value3->create_simple_value( )->set_string( 'GeneralInformation' )   ##NO_TEXT.

The annotation generator of the fact sheets automatically adds an ID to the GeneralInformation collection facet.

Subsections
Each section can also have several subsections. If a collection facet (UI.CollectionFacet) contains several collection facets, each of these becomes a subsection, as in the following example:
<Annotation Term="UI.Facets">

   <Collection>

      <!-- This facet is displayed as before in a section -->

      <Record Type="UI.ReferenceFacet">

         <PropertyValue Property="Label" String="{@i18n>@GeneralInfoFacetLabel}"/>

         <PropertyValue Property="Target" AnnotationPath="@UI.FieldGroup#GeneralInformation" />

      </Record>

      <Record Type="UI.CollectionFacet">

         <PropertyValue Property="ID" String="FurtherData"/>

         <PropertyValue Property="Label" String="{@i18n>@FurtherData}"/>

         <PropertyValue Property="Facets">

            <Collection>

               <!-- This CollectionFacet becomes a subsection with a form with groups -->

               <Record Type="UI.CollectionFacet">