You can define custom parameters for intent-based navigation to the target application.
For information about SAP Fiori elements for OData V4, see Defining Custom Navigation Parameters.
To define custom parameters for intent-based navigation, proceed as follows:
-
Define the
onCustomParamsfunction in the controller file extension.onCustomParams: function(sCustomParams) { if (sCustomParams === "getParameters") { return this.getParameters; } else if (sCustomParams === "param2") { return this.param2; } },The custom parameter function inserts URL parameters while navigating to the target application. Configure the following properties:
Configuration Properties
Property
Description
pathDefines the property name
operatorSpecifies which operator to apply. Possible values are
EQ,NE,LE,GE,LT,GT,BT,CP.value1: First operator value appliedDefines the first value for the operator.
value2: Second operator value. Use only for a range of operators, such asBT. If empty, set the value to null.Defines the second value for the operator. This is used only for range-based operators such as
BT. The value is set tonullif not used.signDetermines whether the current selection must be included or excluded from the filter. Use
Ito include andEto exclude.getParameters: function(oNavigateParams) { var aCustomSelectionVariant = []; var oCustomSelectionVariant = { path: "TaxTarifCode", operator: "EQ", value1: 5, value2: null, sign: "I" }; aCustomSelectionVariant.push(oCustomSelectionVariant); return aCustomSelectionVariant; }, param2: function(oNavigateParams) { oNavigateParams.TaxTarifCode = '3'; return oNavigateParams; }Adding parameters during navigation
getParameters: function(oNavigateParams,oSelectionVariantParams) { // to get the select option property names, make use of this to check what values are available to modify var aSelectOptionNames = oSelectionVariantParams.getSelectOptionsPropertyNames(); var oFilter1 = oSelectionVariantParams.getSelectOption("Filter1"); var oFilter2 = oSelectionVariantParams.getSelectOption("Filter2"); /// Your logic to extract values from oFilter1 and oFilter2 /// /// logic to remove Filter1 and Filter2 /// assigning empty values to Filter1 and Filter2, with ignoreEmptyString as true, this will be removed from the Selection Variant var Filter1 = { path: "Filter1", operator: "EQ", value1: "", value2: null, sign: "I" }; var Filter2 = { path: "Filter2", operator: "EQ", value1: "", value2: null, sign: "I" }; /// logic to remove Filter1 and Filter2 var aCustomSelectionVariant = []; var oFilter3 = { path: "Filter3PropertyName", operator: "EQ", value1: "< Value you want to include >", value2: null, sign: "I" }; aCustomSelectionVariant.push(oFilter3); aCustomSelectionVariant.push(oFilter2); aCustomSelectionVariant.push(oFilter1); return { selectionVariant: aCustomSelectionVariant, ignoreEmptyString: true }; },ignoreEmptyStringandselectionVariantare deprecated as of SAPUI5 1.54. UsebIgnoreEmptyStringandaSelectionVariantinstead. -
Add a controller extension in the
manifest.jsonfile, and specify the path to the custom controller, as shown in the following sample code:"extends": { "extensions": { "sap.ui.controllerExtensions": { "sap.ovp.app.Main": { "controllerName": "my_app.ext.controller.OverViewPageExt" } } } }Add the new extension code in the same file if a controller file already exists.
-
To return the custom parameters during navigation, configure the
customParamssetting in the card definition. Include the name of the custom parameter function defined in your custom controller file."card002_ReorderSoon": { "model": "purchaseOrder", "template": "sap.ovp.cards.list", "settings": { "title": "reorder Soon", "subTitle": "Less than 10 in stock", "listType": "condensed", "entitySet": "PurchaseSet", "customParams": "<function-name>" // Depending on the logic you define in step 1, input the function name. ... ...