Skip to Content
Technical Articles
Author's profile photo Christian Sosa

Enabling Variant Management for Fiori Smart Business Apps

SAP Smart Business apps provide quick KPI analysis and drilldown capabilities[1]. Saving a given configuration can be achieved by creating a new tile in the Fiori Launchpad. For certain use cases, this could lead to the creation of too many tiles, which in turn might become confusing for the end user.

This could be solved by using Variant Management[2] for filter configurations. Since this is not provided by default, the following article will present a way of extending Smart Business apps to support Variant Management.

Requirement

The customer needs to analyse the available options for saving user-defined filters for Smart Business apps. In our example, the chosen app was “PO and Scheduling Agreement Value” (AppID F1378[3]). SAP recommends the usage of tiles for saving configurations, but it is required to evaulate an alternative approach through Variant Management.

Solution

This being an extension requirement, the SAP Guided Answers[4] are a good entry point for finding the available extensibility options.

SAP%20Guided%20Answers%20for%20Smart%20Business%20extensibility

SAP Guided Answers for Smart Business extensibility

Upon checking the available resources, it becomes clear that none of them address the issue of Variant Management. Extending the frontend code itself is then the only option.

Since the app in question is a “SAP Smart Business generic drill down app”, two key infos are needed to create an extension:

  • The Technical Name of the SAPUI5 Application (it is a generic technical app for all Smart Business apps);
  • and the EvaluationId (this provides the specifics of this particular Smart Business app). Both can be found on the Fiori Apps Library[3]

The%20Fiori%20Apps%20Library%20provides%20technical%20configurations%20for%20extensibility

The Fiori Apps Library provides technical configurations for extensibility

Create an extension project for the App SBRT_APPSS1

An extension project can then be created using the development environment of our choice. Here is a possible procedure with the WebIDE Personal Edition:

Extending%20a%20standard%20App%20with%20WebIDE%20Personal%20Edition

Extending a standard app with WebIDE Personal Edition

Set up the run configurations

By providing the previously determined EvaluationId, the newly extended Smart Business app renders the specific app “PO and Scheduling Agreement Value”.

Parameter%20EvaluationId%20determines%20which%20specific%20Smart%20Business%20App%20to%20render

Parameter EvaluationId determines which specific Smart Business app to render

The app should now be up and running in our development environment.

Initially%20working%20application%2C%20still%20without%20support%20for%20variants

Initially working application, still without support for Variant Management

After a quick code walkthrough, two important pieces of information are established:

  • The target UI5 Control for Variant Management is a SmartFilterBar within the fragment SmartFilter.fragment.xml
  • The responsible Controller for the fragment is MainApp.controller.js

According to the SAPUI5 API Reference, two requirements must be met for a SmartFilterBar to support Variant Management[5]:

  • The Parameter useToolbar must be set to true
  • A Persistency Key must be provided

These two parameters can be directly configured through view replacement. However this would put the forward compatibility at risk, so the two parameters will be programatically set through a controller extension.

Extend the MainApp Controller and set the two SmartFilterBar parameters

The following code assumes an ID for the SmartFilterBar ‘ssbSmartFilter’, which is as of version 1.78 valid for the SmartFilterBar. It is important to use the lifecycle method onInit() for the Variant Management to work as expected.

sap.ui.controller("ssuite.smartbusiness.runtime.s1.SmartBusinessExtension.controller.MainAppCustom", {
	onInit: function() {
		this.byId("ssbSmartFilter").setUseToolbar(true);
		this.byId("ssbSmartFilter").setPersistencyKey("PKeyCJ");
	}
});

Variant Management should now be available:

Variant%20management%20is%20now%20available%20for%20the%20SmartFilterBar

Variant Management is now available for the SmartFilterBar

Side-note: Testing Variant Management in the WebIDE

The app could actually be deployed already, since no further coding steps are needed. Testing the Variant Management in the WebIDE requires, however, an additional configuration. The following routes need to be set up in the neo-app.json file:

{
  ...
  "routes": [
    {
	  ...
	},
	{
	  "path": "/sap/bc/lrep/changes",
	  "target": {
		"type": "destination",
		"name": "[INSERT_DESTINATION_NAME]",
		"entryPath": "/sap/bc/lrep/changes"
	  },
	  "description": "S4H_changes"
	},
	{
	  "path": "/sap/bc/lrep/variants",
	  "target": {
		"type": "destination",
		"name": "[INSERT_DESTINATION_NAME]",
		"entryPath": "/sap/bc/lrep/variants"
	  },
	  "description": "S4H_variants"
	},
	{
	  "path": "/sap/bc/lrep/actions/getcsrftoken/",
	  "target": {
		"type": "destination",
		"name": "[INSERT_DESTINATION_NAME]",
		"entryPath": "/sap/bc/lrep/actions/getcsrftoken/"
	  },
	  "description": "S4H_action"
	},
    {
      ...
    }
  ],
  ...
}

Variant Management can now be tested in the WebIDE. In particular, drilldown capabilities are apparently not affected by the new variants.

Takeaways

After testing this approach for several Smart Business apps with no apparent side-effects, we come to the following conclusions:

  • Variant Management can be activated for Smart Business apps with minimal development effort.
  • Default capabilities of Smart Business apps do not seem to be affected.
  • “Save as Tile” option remains unaffected.

Discussion

End user tests have so far been positive for this request and it does provide an added value for our customer. The fact that Variant Management is not available by default remains, at the very least, peculiar. This approach might have hidden risks or maybe Smart Business apps were specifically conceived to only be persisted through tiles and not variants (see relevant SAP Note 3077290).

Resources

The following resources were useful for this analysis:

References

[1] SAP Smart Business Framework: https://experience.sap.com/fiori-design-web/smart-business-drilldown-app/

[2] Variant Management: https://experience.sap.com/fiori-design-web/variant-management/

[3] AppId F1378 – PO and Scheduling Agreement Value: https://fioriappslibrary.hana.ondemand.com/sap/fix/externalViewer/#/detail/Apps(‘F1378’)/S18OP

[4] SAP Guided Answers: https://ga.support.sap.com/dtp/viewer/#/tree/1910/actions/24709:34441:24712

[5] Smart Filter Bar: https://sapui5.hana.ondemand.com/#/api/sap.ui.comp.smartfilterBar.SmartFilterBar%23controlProperties

Assigned Tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Tapan Jain
      Tapan Jain

      Hello Christian,

      Its a very well written blog and I was able to add the Variant management in the Smart Business App after reading it.

      Can you tell me how how to create a custom tile for the extended app?

      I created  a Reference of Target Mapping used in the standard app and changed the URL & ID in it with that of extended app.

      Custom%20Target%20Mapping

      Custom Target Mapping

       

       

      This is the standard Target Mapping

      Standard%20Target%20Mapping

      Standard Target Mapping

       

      Is this the right approach? This is how you did it?

      Author's profile photo Christian Sosa
      Christian Sosa
      Blog Post Author

      Hello Tapan,

      Thanks for your feedback!

      And regarding your question (in case you haven't solved already), your new target configuration looks alright so far. Did you also add the original EvaluationId as parameter? It should be exactly the same of the original tile, for the SmartBusiness App to render properly:

      Required%20EvaluationId%20parameter%20for%20the%20custom%20target

      Required EvaluationId parameter for the custom target

      Kind regards,

      Christian