Call event function from another method in Controller in SAP

It is advised not to call the event function from any other function but what you can do is refactor the event function implementation in a separate function and call that from any other function as shown below:


BtnPress: function(oEvent) {
   // Separate the implementation in the helper function

// Define the helper
btnPressHelper: function() {
   //logic here

// call the helper from whichever function you want to get the desired output
PerformSomething: function() {