Skip to Content

MVC best practices for SAPUI5

Hello gurus,

Are there any best practice guidelines to develop a complex app in SAPUI5? There is an excellent guide Application Best Practice but it looks not full enough.


- where to place the logic which can be called from different views? In the Component.js? How to call it passing the context?

- how to pass data between views controllers?

In WebDynpro MVC approach there is a central Component Controller responsible for data manipulation with backend Model and manage a cross-view data (e.g. settings). So view controllers only handle a user input, manage their local data and then call a central controller.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 30, 2014 at 04:06 PM

    Hi Anton,

    Regarding your first question about reuse logic: I created a custom controller in my utils folder, which implements some mutual functions. View controllers that require the mutual functions inherit from the custom controller, others view controllers are simple sap.ui.controllers.

    An example is given for getrouter, step 3 of application best practices 😉

    Kind regards


    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 29, 2014 at 01:44 PM


    Yes, you could use Component.js to contain the 'mutual' logic which can be called from it's child views/controllers combo's, such as instantiating the core model etc.

    Passing data between view controllers can be done either via the core model (since it will be available to all views as well), or via eventing (have one view fire a data object with a unique eventname, and have another view listen to that specific event name)

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.