Skip to Content

Feature Toggles are gaining popularity amongst S/4HANA Cloud developers. Toggles are live since 1705 for Hidden Code delivery use case. Currently ABAP code can be fully toggled. One of the most requested technology enablement is UI (especially Smart Templates and Fiori Launchpad Content). As a first step towards UI toggling, we (the Feature Management Team of Cloud Foundation) developed a UI Library that simplifies UI elements toggling to some extent.

Currently, to implement Feature Toggle in Fiori apps, we need to either add an entity set in our oData service or do an association with our Feature Toggle CDS views. This involves modification of the backend service.

A better approach to fetch toggle status is to use the Feature Toggle UI Library. Using the UI Library, the developer can obtain the toggle status of a feature by simply calling the library function without any other implementation in the application (i.e. without modifying the backend service). With this, you can toggle UI elements in a freestyle app or write breakout exit for a Smart Template app.

The library is implemented in the UI application as follows:

  1. Add the following code in the pom.xml file of your project.
  1. Add the library (sap.s4h.cfnd. featuretoggle) as a dependency in your project, in either the manifest.json file or the Component.js file if the manifest.json does not exist.
  2. Call the getFeatureStatus() function of the library and pass the Feature ID for the toggle you wish to use.
// Calling the UI Library to get Feature Toggle Status
var sStatus = sap.s4h.cfnd.featuretoggle.lib.features().getFeatureStatus("FeatureID");
// Using the Toggle Status value to toggle UI content

The toggle status returned by this function can be used to toggle any UI element in the Fiori application.

If the toggle does not exist, the default value returned by the function is ‘true’.

Advantages of using the UI library:

  1. No additional oData round trip inside the application: Once the library is loaded, it makes an oData call to fetch the toggle status of all the features and stores them in the cache. So even if the application calls the getFeatureStatus() function multiple times, no additional oData calls are made. This improves the performance of the application.
  2. No additional oData round trip across applications: If one app loads the library and the oData call is made to fetch the toggle status of all features, the data is available in the cache and can be used by all applications in the launchpad. So even if there are multiple applications using the UI Library to fetch the statuses of their respective toggles, there will be only one oData call in one session which will provide the toggle status to all the applications.
  3. No changes needed in the existing oData service to fetch toggle status: The developer only needs to call the UI library.
  4. Loading time of the app with and without library: The application having the library as a dependency takes an average time of 0.08 sec more to load than the app which does not use the library.

For more information, you can visit the following links:

[1] Feature Toggle Wiki

[2] Feature Toggle for S/4HANA Cloud Implementation Guidelines

[3] Feature Toggle JAM Page

To report this post you need to login first.


You must be Logged on to comment or reply to a post.

  1. Arvind Patel

    Hi  Samruddhi,


    Interesting blog. Thanks for sharing detailed steps.

    However when I tired doing the same and loaded these libs, got error saying

    “:Failed to load UI5 component for navigation intent ********** – Error: found in negative cache: ‘sap/s4h/cfnd/featuretoggle/library.js’ from ../../../../../resources/sap/s4h/cfnd/featuretoggle/library.js: 404 – Not Found sap.ushell.renderers.fiori2.Shell.controller

    Is there anything I am missing?


    Thanks in Advance!


Leave a Reply