The extensionAPI
consists of several elements that are described below. It can be used for the list report and object page.
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
. However: Don't access or manipulate controls, properties, models, or other internal objects created by the SAP Fiori elements framework.
Any other methods or properties of the controller (in particular any components whose names start with '_'
) should be considered private and therefore should not be used.
The extensionAPI
can also be used for the analytical list page.
Do not create any instances of classes in the namespace
sap.suite.ui.generic.template
. This namespace is not intended for public use.
You can also access services provided by the template framework. From the controller, you can access these services through <YourController>.extensionAPI
.
This gets you an object that is specific to the template you are currently enhancing, as shown in the examples below:
Template |
Instance |
---|---|
List Report |
|
Object Page |
|
Analytical List Page |
|
|
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 ExtensionAPI, ExtensionAPI for list report extensions and ExtensionAPI for object page extensions.
/* * 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 (oResponse.data.Price > 1000) { sap.m.URLHelper.triggerEmail(null, "critical price change", "changed price of " + oResponse.data.Product_Text + " to " + oResponse.data.Price + " " + oResponse.data.Currency); } }); }
invokeActions
method calls a particular action multiple times and submits changes to the back end.
Parameter Details
Parameter Name |
Details |
---|---|
|
Name of the function or action |
|
Denotes the binding context |
|
Denotes URL parameters (name-value pairs) for the function or action. This is not present in |
|
Sets parameters for invoking application controller's |
|
Determines whether common or unique changeset is sent in batches |
|
Performs asynchronous execution of the action, resolving the same result as the |
|
Throws an error when the OData function import does not exists or the action input parameters are invalid |
You can also access services provided by the template framework. From the controller, you can access these services through getExtensionAPI
.
This gets you an object that is specific to the template you are currently enhancing, as shown in the examples below:
Template |
Instance |
---|---|
List Report |
|
Object Page |
|
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 information about the ExtensionAPI
, see API Reference.