Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
shubhambathla94
Explorer
Hi All,

 

Introduction:

Sometimes there are scenarios when you need to provide a feature in your app, which is only relevant for a small set of End-Users of the App.

Also, this feature could be like a one-time configuration or a switch which means the user will not be using it frequently.

Such kind of feature shouldn't be directly made available to End-Users of the App as it may not be relevant for everyone because of above reasons & also the real estate could be utilized for something important.

Recently I came across such a situation and have used the below approach 🙂

 

Preview:


This is how a custom control in App Settings would look like


 

//****--------- As a Suggestion by marianzeis, Modified on 21/03/2023----------------***//

 

Implementation:

You can use 'onAfterRendering' or 'onInit' method of the controller file of your default view, add the below code

 
onInit: function () {
var oRenderer = sap.ushell.Container.getRenderer("fiori2"),
oAddActionButtonProperties = {
controlType: "sap.m.Button",
oControlProperties: {
id: "exampleButton",
text: "Blog Example Button",
icon: "sap-icon://refresh",
press: function () {
alert("Example Button was pressed!");
}
},
bIsVisible: true,
bCurrentState: true
};
oRenderer.addUserAction(oAddActionButtonProperties);
}

 

Result:

Run the App & you should see the button under 'App Settings'.


Please let me know if you have any suggestions or feedback.

 

Thanks,

Shubham
2 Comments
Labels in this area