ERPClimb logoERPClimb
SAPUI5 and SAP Fiori Tools
RAP / CDS / ODatabeginner 10 min read

SAPUI5 and Fiori Tools Part 1: MVC, Models, Views and Controllers

Free sample lesson · open to everyone

Key takeaway

Learn how a freestyle SAPUI5 app is structured — Component. js and manifest. json describe the app, the View declares UI in XML, the Model holds data, and the Controller wires user interaction together — and understand when freestyle UI5 is the right choice instead of Fiori Elements.

In this lessonShow sections

Visual overview

SAPUI5 and Fiori Tools Part 1: MVC, Models, Views and Controllers — learning sheetIn one line: Learn SAPUI5 architecture in simple language: MVC, controls, models, data binding, components and the runtime flow of a typical Fiori application.ERPClimb.com / RAP / LESSON 1/7 / LEARNING SHEETSAPUI5 and Fiori Tools Part 1: MVC, Models, Views andControllers1 · IN ONE LINELearn SAPUI5 architecture in simple language: MVC, controls, models, data binding,components and the runtime flow of a typical Fiori application.2 · KEY IDEAS EXPLAINED11. MVC and application architecture 2. SAP Fioritools setup and project generation 3. Models anddata binding 4. Routing, navigation, fragments anddialogs 5. OData V4 CRUD and backend integration6. Debugging, testing and performance 7.Deployment and production lifecycle2Fiori Elements is excellent when a metadata-drivenfloorplan fits the requirement. SAPUI5 is stillimportant when you need a freestyle application,custom interaction, special visualization ordeeper frontend control.3Do not choose freestyle UI5 simply because itfeels more flexible. More custom UI code alsomeans more code to test and maintain.4Model holds data. View describes UI. Controllerhandles interaction and orchestration.3 · DO · AVOIDBest practice!Common mistakeKeep controllers thin.Use manifest configuration.Use i18n.✕Giant controllers.✕Direct DOM manipulation.✕Hard-coded UI text.4 · IN A REAL PROJECTA team builds a custom order app with all data and validation logic inside one controller. Every change breaksunrelated behavior. Refactoring models, reusable services and backend validation makes the applicationmaintainable.Original ERPClimb learning sheet • Verify against your SAP release and edition

Expert visual walkthrough

RAP · CDS · ODATA ACADEMY · Architecture hierarchyERPClimb.com

MVC, Models, Views and Controllers

SAPUI5 and SAP Fiori Tools · Chapter-specific technical teaching map

Architecture hierarchy

1Top level

App view

2Related level

Controller / model

3Related level

OData binding

4Related level

Backend service

Tutor's chapter takeaway

Learn how a freestyle SAPUI5 app is structured — Component.js and manifest.json describe the app, the View declares UI in XML, the Model holds data, and the Controller wires user interaction together — and understand when freestyle UI5 is the right choice instead of…

In a real project

A freestyle app for approving purchase requests put every button handler, OData call and status-text rule directly into Main.controller.js. After six months the controller had grown past 1,500 lines, and a developer asked to…

Watch out for

• Writing all interaction and business logic into one controller instead of delegating to models, formatters and the backend — it is the fastest way to get something on screen, but it does not scale; keep controllers to event…

Conceptual study map, not an SAP configuration screenshot or a guaranteed runtime sequence. Consult the lesson for implementation prerequisites and exceptions.

The situation: a real project scenario

A freestyle app for approving purchase requests put every button handler, OData call and status-text rule directly into Main.controller.js. After six months the controller had grown past 1,500 lines, and a developer asked to add a "reject with reason" dialog could not find where the approval rule actually lived. Splitting the controller into thin event handlers, moving display logic into a formatter, and keeping the approval rule in the RAP behavior implementation turned the next change into a one-line call instead of a day of reading someone else's controller.

Explanation

In MVC, the Model holds data, the View describes the UI in XML, and the Controller handles interaction logic. An application's Component.js and manifest.json together describe the app as a whole — its models, routing and dependencies. Views bind to models declaratively, and controllers should stay thin. Freestyle UI5 is worth choosing only when Fiori Elements genuinely cannot fulfill the requirement.

This complete series covers SAPUI5 across seven parts: MVC and application architecture; SAP Fiori tools setup and project generation; models and data binding; routing, navigation, fragments and dialogs; OData V4 CRUD and backend integration; debugging, testing and performance; and deployment and the production lifecycle.

SAPUI5 still matters because, while Fiori Elements is excellent when a metadata-driven floorplan fits the requirement, SAPUI5 remains important whenever you need a freestyle application, custom interaction, special visualization, or deeper frontend control. It's worth being disciplined here — freestyle UI5 shouldn't be chosen simply because it feels more flexible, since more custom UI code also means more code to test and maintain.

MVC can be summarized in one sentence: the Model holds data, the View describes the UI, and the Controller handles interaction and orchestration. That separation is what makes a UI easier to understand and test.

A modern SAPUI5 application normally has an application component paired with a manifest. The manifest describes configuration such as the application ID, models and data sources, routing, dependencies, and device or resource settings — and it's worth keeping configuration declarative wherever the framework supports it.

On models: common concepts include a JSON model for local or client-side data, a resource model for translated text, and an OData model for backend service data. A model isn't a database — it's the client-side abstraction that controls and bindings actually work against.

Data binding means that, instead of manually copying values into every UI control, the UI is bound directly to model paths — for example, an Input control's value might be bound to "{/customer/name}". When the model changes, the binding keeps the UI synchronized according to whatever binding mode is in effect.

UI5 controls expose properties, events and aggregations. A table, for instance, aggregates items; a page aggregates content; a button raises a press event. The goal is to understand the control API rather than manipulate the DOM directly.

A controller's job is to coordinate UI behavior, not to become a 3,000-line business engine. Good controller tasks include event handling, navigation, model orchestration, delegating formatting, and calling reusable services — backend business validation should stay on the backend, not migrate into the controller.

By the end of this you should be able to explain the runtime path end to end: Component leads to manifest, which leads to model, which leads to view binding, which leads to a controller event, which leads to a call into the service or backend.

Common mistakes to avoid include writing all logic into one controller, manipulating the HTML DOM directly, hard-coding texts instead of using i18n, choosing freestyle UI5 when Fiori Elements already fits, and duplicating backend business rules in JavaScript.

As an interview-ready summary: SAPUI5 is a component-based JavaScript UI framework. Freestyle apps are structured with manifest-driven configuration, MVC, models and declarative data binding, with controllers orchestrating UI behavior while authoritative business rules remain in backend services.

Code example

ABAP Code
// ===== Component.js - the app entry point =====sap.ui.define(["sap/ui/core/UIComponent"], function (UIComponent) {  "use strict";  return UIComponent.extend("zpurchreq.Component", {    metadata: { manifest: "json" },          // configuration comes from manifest.json    init: function () {      UIComponent.prototype.init.apply(this, arguments);      this.getRouter().initialize();         // start routing (Part 4)    }  });}); // ===== manifest.json (excerpt) =====// "sap.app":  { "id": "zpurchreq", "i18n": "i18n/i18n.properties", ... }// "sap.ui5":  { "rootView": { "viewName": "zpurchreq.view.App", "type": "XML" },//               "models": { "i18n": { "type": "sap.ui.model.resource.ResourceModel",//                                     "settings": { "bundleName": "zpurchreq.i18n.i18n" } } } } <!-- ===== view/Main.view.xml - the View (UI only) ===== --><mvc:View controllerName="zpurchreq.controller.Main"          xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m">  <Page title="{i18n>appTitle}">    <Input value="{/request/description}" placeholder="{i18n>description}" />    <Button text="{i18n>save}" type="Emphasized" press=".onSave" />  </Page></mvc:View> // ===== controller/Main.controller.js - the Controller (interaction) =====sap.ui.define(["sap/ui/core/mvc/Controller", "sap/ui/model/json/JSONModel",               "sap/m/MessageToast"], function (Controller, JSONModel, MessageToast) {  "use strict";  return Controller.extend("zpurchreq.controller.Main", {    onInit: function () {      // the Model: data for this view      this.getView().setModel(new JSONModel({ request: { description: "" } }));    },    onSave: function () {      const sText = this.getView().getModel().getProperty("/request/description");      MessageToast.show("Saved: " + sText);   // real apps save via the OData model (Part 5)    }  });}); # ===== i18n/i18n.properties =====# appTitle=Purchase Requests# description=Description# save=Save

Watch out

Common mistakes

  • Writing all interaction and business logic into one controller instead of delegating to models, formatters and the backend — it is the fastest way to get something on screen, but it does not scale; keep controllers to event handling, navigation and orchestration only.
  • Manipulating the DOM or rendered HTML directly (e.g. jQuery against control internals) instead of using the control's own API — breaks silently on UI5 version upgrades and is hard to test.
  • Hard-coding UI text instead of using i18n resource bundles from the first view — turns every text change or translation into a code change and a transport.
  • Duplicating backend business validation in JavaScript "for faster feedback" — creates two sources of truth that drift apart; keep the authoritative rule in the backend (RAP) and treat any frontend check as a UX shortcut only.
  • Reaching for freestyle UI5 by default because it "feels more flexible" when a Fiori Elements floorplan would already cover the requirement — buys ongoing maintenance cost for no business benefit.

Do this

Best practices

  • Keep controllers thin — event handling, navigation and orchestration only; push formatting to formatters and business rules to the backend.
  • Drive app configuration (models, routing, dependencies, device settings) through manifest.json rather than code, so tooling and other developers can read it declaratively.
  • Externalize every user-facing string to i18n.properties from the first view, not as a later cleanup.
  • Prefer declarative data binding over imperative getControlById().setValue() calls — it scales better as the view grows and survives re-renders.
  • Default to Fiori Elements; choose freestyle SAPUI5 only when a specific interaction or visualization genuinely cannot be expressed through annotations.

In the interview

Interview angle

Questions: "Explain MVC in SAPUI5", "What goes in Component.js versus manifest.json?", "Why use data binding instead of calling setText() in a click handler?", "When would you choose freestyle UI5 over Fiori Elements?"

Strong answer: Model holds data, View declares UI in XML, Controller handles interaction; Component.js bootstraps the app and reads its configuration (models, routing, dependencies) from manifest.json so configuration stays declarative and tool-readable; binding keeps the UI synchronized with the model automatically instead of scattering manual get/set calls across handlers; freestyle UI5 is justified only when a metadata-driven floorplan genuinely cannot deliver the required interaction — picking it as a default is a maintenance cost with no payoff. A weak answer treats MVC as just "three folders" without explaining what actually moves data to the screen.

Practice this lesson

Quick check

0 of 3 questions attempted

Question 1 of 3

What is the main purpose of manifest.json in a SAPUI5 app?

Practise this in an interview

Answer in your own words and get instant feedback, the way an interviewer would judge it.

1Explain MVC in SAPUI5 and the role of Component.js and manifest.json.

2A freestyle app has 2,000-line controllers mixing UI, data and business logic. How do you restructure it?

See it in code

Each example starts from a requirement, shows the design, then the code step by step with a plain-language explanation of every part.

Was this lesson helpful?

Keep exploring

Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.