What is the smart field of SAP ui5


Smartfield controls interpret metadata representing entity relationship models, data types, service functions, and annotations in OData services for automatic generationUnderlying internal controlsAnd reduce the amount of code required to develop applications. In some cases, OData entities derive from the binding context of the control. The properties of the OData entity changed or displayed with the control are derived from the value property of the control.

Important: like all sapui5 smart controls, smartfield will retrieve and analyze metadata and comments of OData service. OData metadata is its main API. These OData services are not part of the sapui5 framework and are usually maintained by the back-end developers of the application.

Over time, smartfield can evolve and gain new capabilities. This means that if the annotation defining this change remains in the back-end metadata, its behavior or functionality may change. To benefit from the new functionality, SAP ui5 applications should be able to adapt to back-end metadata. Therefore, SAP recommends using smartfield only when developers have complete control over the metadata of the application


For interoperability and accessibility reasons, smartfield controls must be controlled by SAP ui. comp. smartfield. SmartLabel control instead of SAP m. Label control tag because sap m. The label control does not know the internal structure. It is a smartfield control. If a smartfield control is rendered in a smart container control (such as a smartform control), a SmartLabel control is automatically generated to reduce the amount of code required on the application side. However, in other cases, when smartfield is used alone or outside the smart container control, such as simpleform control, SmartLabel control will not be generated automatically in these cases. Although sap ui. comp. smartfield. SmartLabel is a private / internal control, but the application allows the following basic uses to tag smartfield controls.

An example:

<sap.ui.comp.smartfield.SmartLabel labelFor="IDProduct"/>
<sap.ui.comp.smartfield.SmartField id="IDProduct" value="{ProductId}"/>

SmartLabel controls alone are not recommended. Only basic use is allowed, excluding automatic processing visibility. If used alone, the application logic must pay attention to the visibility of labels.


Defines whether the field is mandatory, hidden, or in read-only / editable mode.

The entity data model (EDM) attribute can use com.com in OData V4 model sap. vocabularies. Common. v1. The FieldControl annotation or sap: field control annotation in OData V2 model is dynamically annotated by providing the binding path type to another attribute as EDM The EDM attribute of byte, whose value in the data model can be:

  • 0: indicates that the field is hidden. Note: hidden is a synonym that is not applicable and is not recommended. Do not use it to statically hide the fields on the user interface, but use the static FieldControl annotation.
  • 1: Indicates that the field is in read-only mode and its value cannot be changed. Note: to statically annotate EDM properties as read-only, use org. Instead OData. Core. V1. Computed comment.
  • 3: Indicates that the field is editable and optional (default).
  • 7: Indicates that this field is mandatory from a business perspective. This value does not imply any limitation on the range of values for the EDM attribute. For example, to limit the use of value ranges, you must use the standard type facet nullable with a value of false to exclude null values, or you must use org OData. Validation. V1 terms in the glossary.