Show TOC

API for Developers of Smart Template ExtensionsLocate this document in the navigation structure

The API consists of several elements that are described in the sections that follow.

Standard SAPUI5 API

In extension coding, you can use the standard SAPUI5 programming API. However, this should be handled with care.

After you have defined a view extension, you can access and modify the properties of all UI elements defined within these extensions (for example, change the visibility programmatically). However, you cannot access any UI elements that are not defined within your view extensions.

In addition, do not use the following:
  • Services provided by the namespace, since these services are only intended to be used by freestyle-apps or are used within the generic smart template implementation.
  • Services provided by the namespace sap.ui.generic.template directly: Unwanted side effects may occur if two layers (smart template coding and extension coding) access these services at the same time.

Several models (instances of sap.ui.model.Model) are attached to the smart template artifacts.

  • OData Model

    The most prominent is the default model, which is in fact the OData model specified in the manifest.json file. You can use this model for data-binding in your own view extensions.

    Accessing the model programmatically (through the standard SAPUI5 API methods) should be done with care, since side effects may interfere with the smart template coding that also uses this model.

    This applies in particular to function imports. Therefore, use method invokeActions of the extension API (see below) to call function imports.

  • UI Model

    Each view has its own model attached that has the name ui. This model can be used in view and controller extensions for read purposes.

    This model contains the following properties, all of which have Boolean values:
    • enabled: Indicates whether active UI elements (such as buttons) should be enabled.
    • editable: Indicates whether input fields or similar UI elements should be in an editable state.
    • createMode: Indicates whether the UI displays an entity that is about to be created (no active version exists yet).

    Note that it is also possible to register changes to these properties. However, the logic at which point in time these properties are set and reset can still be changed.

    Caution It is strictly forbidden to perform any change operations on the properties of the UI model.
  • Smart Template Private Model

    There is an additional model that is attached to each view which contains properties used for internal purposes within the smart template.

    Caution It is strictly forbidden to access this model in any way. Do not access any model other than the default model and the model with name ui unless you have attached it to the ManagedObject yourself.
  • Application-Specific Models

    You may want to define your own JSON model and attach it to UI elements. You can do this easily if the model is attached to a UI element that only exists within the scope of an extension. However, models that are attached to a higher level (for example, to the whole view) should only be used if absolutely necessary.

    In this case, you should use a name containing your own namespace to clearly separate this model from models defined by other parts of the framework.

API Methods

When coding the implementation of an extension hook or an event handler used in a view extension, you can use the public methods of sap.ui.core.mvc.Controller. For important information about using standard SAPUI5 programming APIs, see the relevant section above.

In addition, you may want to access a service provided by the smart template framework. From the controller, you can access these services through <YourController>.extensionAPI.

By doing so, you obtain an object that is specific to the template you are currently enhancing, as shown in the examples below:



List Report


Object Page


Note Do not rely on the names of these classes in your coding, as they can still be changed. However, the set of methods provided by these objects will only be extended in a compatible way.

For more information, see the API Reference for sap.suite.ui.generic.template.ListReport.extensionAPI.ExtensionAPI and for sap.suite.ui.generic.template.ObjectPage.extensionAPI.ExtensionAPI in the Demo Kit.

Any other methods or properties of the controller (in particular any components with a name starting with ‘_’) should be considered private and therefore not be used.

Caution Do not create any instances of classes in the namespace sap.suite.ui.generic.template on your own, as it is not intended for public use.
Sample Code
 * Assumed use case: When the price is changed to a critical value (more than 1000), an email should be generated and sent.
 * This should not happen for changes to the draft but only after activation has been successfully processed in the
 * back-end system.
 (function() {
	"use strict";
	function onAfterActivate(oEvent) {
		* AfterActivate event is raised at the end of front-end processing for activation. The object handed into the
		* handler contains a promise that is resolved after a successful response from the back-end system.
		oEvent.activationPromise.then(function(oResponse) {
			if ( > 1000) {
			sap.m.URLHelper.triggerEmail(null, "critical price change", "changed price of " +
			+ " to " + + " " +;