Beyond ABAPdesigned by@Tejoram97
Beyond ABAP / SAPUI5 / SAPUI5 Fundamentals

SAPUI5 Fundamentals

SAPUI5 · SAP Fiori UI5 and Mobile ·

Open the interactive lesson →
  1. What SAPUI5 is
  2. Architecture and libraries
  3. Tools and creating a project
  4. Project structure
  5. Bootstrap and how an app starts
  6. Component.js and manifest.json
  7. MVC: XML views and controllers
  8. Controls
  9. Events
  10. Modern UI5: asynchronous APIs and the UI5 2.x path
  11. Putting it together: the Sales Order Approval dashboard
  12. Debugging and useful links
  13. Interview questions

How a SAPUI5 app is built: what the framework is, its libraries, the tools, the project structure, how an app starts (bootstrap, Component.js, manifest.json), MVC with XML views and controllers, the controls you use every day, events and debugging. Two examples are used: a small Products app (namespace my.products) for the basics, and the Sales Order Approval dashboard, a freestyle app on the OData V4 service ZUI_SalesOrder_O4, that puts everything together (Part 11). Data, binding, OData, routing and deployment follow on SAPUI5 › 04 · Data, Binding & Navigation.

Part 1 – What SAPUI5 is

SAPUI5 is SAP's JavaScript UI framework for building responsive enterprise web apps that run in the browser on desktop, tablet and phone. It is based on HTML5, CSS3 and JavaScript and implements the SAP Fiori design, so apps built with it look and behave like SAP's own Fiori apps.

  • OpenUI5 is the open-source core of SAPUI5 (Apache 2.0 licence): the runtime and most control libraries.
  • SAPUI5 = OpenUI5 + extra libraries (charts, smart controls, SAP Fiori elements). It is delivered with SAP products: the ABAP platform (S/4HANA, SAP Gateway) and SAP BTP.
  • UI5 Tooling is not the framework itself: it is the Node.js command-line tool (@ui5/cli, now called UI5 CLI) used to serve, build and test UI5 projects (Part 3).
  • SAP Fiori is the design system and UX; SAPUI5 is the main technology that implements it (→ see SAP Fiori › 01 · SAP Fiori Design & Architecture). SAP Fiori elements generates complete UI5 apps from OData annotations (SAP Fiori › 03 · SAP Fiori Elements). Hand-written UI5 apps are called freestyle apps; this page and SAPUI5 › 04 teach freestyle development.

Framework, library, class

Level

What it is

Example

Framework

A collection of libraries plus the runtime that loads and renders them

SAPUI5

Library

A collection of related classes (controls, types, helpers), named in lower case

sap.m, sap.ui.table

Class

One control or helper, named in UpperCamelCase; has properties, aggregations, associations, events and methods

sap.m.Button, sap.m.Input

UI5 apps vs classic ABAP (Dynpro) apps

Aspect

Classic ABAP / SAP GUI (Dynpro)

SAPUI5 / Fiori app

Where the UI runs

On the application server; SAP GUI only displays the screen

In the browser; controls are rendered on the client

State

Stateful: the user session keeps memory on the server between dialog steps

UI state in the browser; the OData service is stateless (each request stands alone)

Round trips

Every user action (Enter, button) goes to the server (PAI / PBO)

UI events are handled in the browser; only data requests go to the server

Devices

Desktop with SAP GUI installed (or SAP GUI for HTML)

Any modern browser; responsive layouts for desktop, tablet and phone

Access

Mostly inside the company network

Intranet and internet (launchpad, Web Dispatcher, BTP)

Controls

A limited set of screen elements

Hundreds of controls across the libraries

Languages

ABAP

JavaScript and XML for the UI; ABAP (RAP, SEGW) or CAP for the service

Part 2 – Architecture and libraries

SAPUI5 architecture: application, control libraries, SAPUI5-only libraries, sap.ui.core runtime, themes and the browser

Library

What you find in it

OpenUI5?

sap.ui.core

Runtime: module loader, MVC (sap.ui.core.mvc is a namespace in it, not a library), models, binding, routing, rendering, core:Item, Fragment

Yes

sap.m

Main responsive control set: App, Page, Button, Input, Select, List, Table, Dialog, MessageBox

Yes

sap.f

Fiori layouts: DynamicPage, FlexibleColumnLayout, Card, ShellBar, Avatar

Yes

sap.ui.layout

Grid, Splitter, BlockLayout; sub-namespace sap.ui.layout.form: SimpleForm, Form

Yes

sap.ui.table

Desktop grid tables for large data: Table, TreeTable

Yes

sap.ui.unified

FileUploader, Calendar, Menu, ColorPicker

Yes

sap.uxap

ObjectPageLayout (header + sections)

Yes

sap.tnt

ToolPage, SideNavigation, ToolHeader (admin-style apps)

Yes

sap.ui.comp

Smart controls for OData V2: SmartTable, SmartFilterBar, SmartField

No (SAPUI5)

sap.viz

Charts: VizFrame + FlattenedDataset

No (SAPUI5)

sap.suite.ui.microchart

Micro charts (small KPI charts in tables, tiles)

No (SAPUI5)

sap.ui.mdc, sap.fe.*

Metadata-driven controls and SAP Fiori elements for OData V4 (SAP Fiori › 03)

sap.ui.mdc yes, sap.fe no

  • Themes: sap_horizon is the current default; sap_fiori_3 (Quartz) is the previous one; sap_belize was removed in 1.136; dark and high-contrast variants exist (sap_horizon_dark, sap_horizon_hcb). Content density: cozy (touch) is the default; add the CSS class sapUiSizeCompact for mouse-driven desktop screens.
  • Versions: UI5 1.x is released continuously, with selected long-term maintenance releases; from 1.136 a new maintenance strategy applies (see https://ui5.sap.com/versionoverview.html). UI5 2.x is the announced next major version: it removes all APIs deprecated with or before 1.136 – global names like sap.m.Button, jQuery.sap.*, synchronous loading, the sap.ui.getCore() facade, JS/JSON/HTML views, old themes. SAP's advice is to write best-practice 1.x code now so the app runs on 2.x without migration; check the current documentation for the 2.x release status. Replacements: Part 10.

Control class hierarchy

  • sap.ui.base.Object → EventProvider (events) → ManagedObject (properties, aggregations, associations, binding) → sap.ui.core.Element → sap.ui.core.Control (can render itself) → Button, List, Table. A view is also a control.
  • If you cannot find a property, method, event or aggregation in a control's API reference, look in its parent class: everything is inherited.

Part 3 – Tools and creating a project

Tool

What it is

When to use

SAP Business Application Studio (BAS)

SAP's cloud IDE on SAP BTP, built on Code-OSS (the open-source base of VS Code). Dev spaces such as "SAP Fiori" come pre-configured with all Fiori tools; nothing to install, needs internet and a BTP subscription (trial / free tier for learning)

Company projects on BTP, CAP, when the backend is reached through BTP destinations

VS Code + SAP Fiori tools

Microsoft's free local editor plus the SAP Fiori tools Extension Pack (Application Generator, Application Modeler / Page Map, Guided Development, Service Modeler, XML annotation language server) and the UI5 Language Assistant (code completion in XML views)

Local development, works offline; reaches on-premise systems through the company network or VPN

UI5 CLI (@ui5/cli, formerly called UI5 Tooling)

Node.js CLI: ui5 init, ui5 serve, ui5 build; configured in ui5.yaml

Every project (generated apps already include it)

SAP Fiori tools CLI (@sap/ux-ui5-tooling)

fiori run (local server with proxy and preview), fiori add deploy-config, fiori deploy

Local testing against a backend, deployment

  • Code completion: in an XML view, type < and press Ctrl+Space to list controls, or <Button + Ctrl+Space to list its properties, aggregations and events (UI5 Language Assistant).
  • Legacy – know it for interviews: SAP Web IDE (the former cloud IDE, no longer actively supported or distributed; replaced by BAS) and Eclipse with the UI5 plug-in. Its App Descriptor Editor is replaced by editing manifest.json or the Fiori tools Application Modeler.

Generate a project (normal way)

Use the SAP Fiori application generator: in BAS or VS Code run the command "Fiori: Open Application Generator" and choose a template (Basic for freestyle UI5, or a Fiori elements floorplan), the data source (a system, a service URL or none) and the namespace. It creates the full structure of Part 4, including package.json scripts: npm start (local run), npm run build, npm run deploy.

Create a project by hand (to understand the pieces)

  • Prerequisites: Node.js (a current LTS version) and an editor.
mkdir my-products && cd my-products
npm init -y                                  # package.json: UI5 Tooling is a Node.js tool
npm install --save-dev @ui5/cli              # local install, run via npm scripts or npx
npm install --save-dev @sap/ux-ui5-tooling   # optional: fiori run, proxy, deploy
# create webapp/manifest.json (needs at least sap.app.id) and webapp/index.html
npx ui5 init                                 # detects webapp/manifest.json, writes ui5.yaml
npx ui5 serve --open index.html              # local server,  http://localhost:8080
  • webapp/ is the standard folder for all productive files; UI5 Tooling recognises an application only if webapp/manifest.json exists and has an app ID.
  • npm install --global @ui5/cli also works (then ui5 --help), but a project-local devDependency keeps every developer on the same version.
# ui5.yaml – written by ui5 init (specVersion depends on the installed UI5 Tooling)
specVersion: "4.0"
metadata:
name: my.products
type: application
  • Tooling in depth (ui5.yaml, middlewares, custom tasks, TypeScript, the UI5 linter) → see SAPUI5 › 05 · UI5 Tooling, TypeScript & Custom Controls.

Part 4 – Project structure

my-products/
├── package.json             npm scripts (start, build, deploy) and devDependencies
├── ui5.yaml                 UI5 Tooling: server middlewares (proxy, preview), build
├── ui5-deploy.yaml          deployment target (created by fiori add deploy-config)
└── webapp/                  everything that is deployed
├── index.html           standalone launcher for local testing (bootstrap)
├── Component.js         the app's entry point
├── manifest.json        app descriptor: models, routing, libraries
├── controller/          App.controller.js, List.controller.js, BaseController.js
├── view/                App.view.xml, List.view.xml, ProductDialog.fragment.xml
├── model/               formatter.js, models.js
├── i18n/                i18n.properties, i18n_de.properties
├── css/                 style.css (custom styling, use sparingly)
├── localService/        metadata.xml and mock data for the mock server
└── test/                unit/ (QUnit) and integration/ (OPA5)
  • Root view + container: App.view.xml holds a container control, sap.m.App (one page at a time) or sap.m.SplitApp (master list on the left, detail on the right, aggregations masterPages and detailPages). The router places the other views into it (SAPUI5 › 04).
  • BaseController: a shared parent controller with helpers (getRouter(), getModel(name), getResourceBundle(), onNavBack()); every view controller extends it instead of Controller.
  • Legacy: neo-app.json (SAP BTP Neo environment, end of life – SAP Note 3351844) and Gruntfile.js (old build) are replaced by ui5.yaml / xs-app.json and UI5 Tooling.

Part 5 – Bootstrap and how an app starts

Bootstrapping is loading and initialising the UI5 runtime. A <script> tag with the ID sap-ui-bootstrap loads sap-ui-core.js; its data-sap-ui-* attributes configure the runtime. The core initialises as soon as the browser has loaded and executed this script.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Products</title>
<script id="sap-ui-bootstrap"
src="https://ui5.sap.com/resources/sap-ui-core.js"
data-sap-ui-theme="sap_horizon"
data-sap-ui-resource-roots='{ "my.products": "./" }'
data-sap-ui-on-init="module:sap/ui/core/ComponentSupport"
data-sap-ui-compat-version="edge"
data-sap-ui-async="true">
</script>
</head>
<body class="sapUiBody" id="content">
<div data-sap-ui-component data-name="my.products" data-id="container"
data-settings='{ "id": "products" }'></div>
</body>
</html>

Attribute

Meaning

src

Where UI5 comes from: the SAP CDN ( https://ui5.sap.com/resources/…, or a versioned URL such as https://ui5.sap.com/1.120.0/resources/…), or resources/sap-ui-core.js served locally by UI5 Tooling

data-sap-ui-theme

Theme to load, e.g. sap_horizon

data-sap-ui-resource-roots

Maps your namespace to a folder: modules my/products/... are loaded from ./

data-sap-ui-on-init

What to run when the core is ready; module:sap/ui/core/ComponentSupport creates the component declared in the <div data-sap-ui-component> (older apps: data-sap-ui-oninit)

data-sap-ui-async

Load libraries and modules asynchronously (always true for new apps)

data-sap-ui-compat-version

Must be edge (newest runtime behaviour); other values are deprecated

data-sap-ui-libs

Optional list of libraries to preload; with a component, the manifest's dependencies/libs does this

  • Standalone vs launchpad: index.html is only for running the app on its own (local testing). In the SAP Fiori launchpad or SAP Build Work Zone the launchpad has already bootstrapped UI5 and starts your Component.js directly. That is why all app logic must start in the component, never in index.html.
  • Core ready: code that must wait for the core uses Core.ready() (module sap/ui/core/Core, returns a promise) or an on-init module; sap.ui.getCore().attachInit(...) is deprecated. Options are written in kebab-case (data-sap-ui-on-init); camelCase forms come from samples older than UI5 1.120.
App start sequence: index.html bootstrap, core and ComponentSupport, Component.js, manifest.json, root view, router, data requests, rendering
  • Legacy: apps that create views directly in index.html (sap.ui.xmlview(...).placeAt("content")), JS views with createContent/getControllerName, and a sap.m.Shell wrapper are old patterns.

Part 6 – Component.js and manifest.json

Component.js reads manifest.json (sap.app, sap.ui, sap.ui5, sap.fiori, sap.cloud) and the runtime creates libraries, models, root view, router and the launchpad intent

Component.js

The component is the app's entry point and the unit the launchpad starts. There is one root component per app (reuse components can be embedded in addition). It extends sap/ui/core/UIComponent, which provides the router and creates the root view and the models from the manifest.

sap.ui.define([
"sap/ui/core/UIComponent",
"sap/ui/Device",
"sap/ui/model/json/JSONModel"
], (UIComponent, Device, JSONModel) => {
"use strict";

return UIComponent.extend("my.products.Component", {
metadata: {
manifest: "json",                                  // read manifest.json
interfaces: ["sap.ui.core.IAsyncContentCreation"]  // create root view asynchronously
},

init() {
UIComponent.prototype.init.apply(this, arguments); // models + root view from manifest
const oDeviceModel = new JSONModel(Device);        // device info for the views
oDeviceModel.setDefaultBindingMode("OneWay");
this.setModel(oDeviceModel, "device");
this.getRouter().initialize();                     // start routing (SAPUI5 › 04)
}
});
});
  • Always call the parent init first; without it there are no manifest models and no router.
  • Asynchronous creation: the launchpad and ComponentSupport create the component asynchronously. In code use await Component.create({ name: "my.products", manifest: true }) or a sap.ui.core.ComponentContainer with async: true; sap.ui.component(...) is deprecated. IAsyncContentCreation also makes the root view and its nested views load asynchronously.
  • Overriding createContent (to build the root view in code) and destroy is possible but rarely needed: the root view comes from sap.ui5/rootView in the manifest.
  • The component instance lives as long as the app: shared models and the router belong to it. In a controller you reach it with this.getOwnerComponent().

manifest.json (app descriptor)

The app descriptor describes the app in one declarative JSON file: identity, data sources, models, libraries, root view, routing, launchpad integration. A new team member can read it to understand the app; the framework reads it to create models and routing automatically (manifest-first), so no hand-written model code is needed.

{
"sap.app": {
"id": "my.products",
"type": "application",
"i18n": "i18n/i18n.properties",
"title": "{{appTitle}}",
"applicationVersion": { "version": "1.0.0" },
"dataSources": {
"mainService": {
"uri": "/sap/opu/odata4/sap/zui_product_o4/srvd/sap/zui_product/0001/",
"type": "OData",
"settings": { "odataVersion": "4.0" }
}
}
},
"sap.ui": {
"technology": "UI5",
"deviceTypes": { "desktop": true, "tablet": true, "phone": true }
},
"sap.ui5": {
"rootView": { "viewName": "my.products.view.App", "type": "XML", "id": "app" },
"dependencies": {
"minUI5Version": "1.120.0",
"libs": { "sap.m": {}, "sap.f": {} }
},
"contentDensities": { "compact": true, "cozy": true },
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"settings": { "bundleName": "my.products.i18n.i18n" }
},
"": {
"dataSource": "mainService",
"preload": true,
"settings": { "operationMode": "Server", "autoExpandSelect": true }
}
},
"routing": { "config": {}, "routes": [], "targets": {} }
}
}

Section

Holds

sap.app

App identity and resources: id (= namespace), type, title, i18n, applicationVersion, dataSources (OData service URIs, annotation files), crossNavigation (launchpad inbounds)

sap.ui

UI technology and supported deviceTypes; icons; supported themes

sap.ui5

UI5-specific runtime config: rootView, dependencies (min UI5 version, libraries), models, routing, resources (extra CSS/JS), contentDensities, extends

sap.fiori

Launchpad info: registrationIds (Fiori app ID), archeType (transactional, analytical …)

sap.cloud, sap.platform.*

Deployment info for SAP BTP (service name) and other platforms

_version

Descriptor format version; written by the generator

  • The dataSources URI is always relative (/sap/opu/...); never hard-code a host. During local development a proxy forwards it to the backend (SAPUI5 › 04).
  • {{appTitle}} is replaced by the text with key appTitle from the i18n file named in sap.app/i18n.

Part 7 – MVC: XML views and controllers

MVC: the controller modifies model and view; model and view stay in sync through data binding; the view notifies the controller of user events

Part

Role

In UI5

Model

Holds the application data and offers methods to read and change it

JSONModel, ResourceModel, ODataModel (V2/V4) – client-side objects (SAPUI5 › 04)

View

Defines and renders the UI (presentation only)

*.view.xml; fragments for reusable parts

Controller

Reacts to view events and user input; changes the view and the model; mediates between them

*.controller.js: event handlers, navigation, calls to the model, validation, data flow between views

  • Advantages: UI and logic are separated, so each is easier to read, test and change; several views can show the same data; views and controllers are reusable units that different developers can work on in parallel.
  • A view and its controller are usually 1:1 and share a name (List.view.xml + List.controller.js). A view has at most one controller; a controller class can be reused by several views; views without a controller are allowed, and a controller can also exist without a view (e.g. a BaseController that only holds shared helpers for the other controllers to extend). Technically a view is a control and can have or inherit models.

View types

Type

Status

XML view (*.view.xml)

Recommended. Declarative, enforces separation of UI and logic, best tool support; the only type that supports SAPUI5 flexibility (key user adaptation), extension points and XML templating used by Fiori elements

Typed view (class extending sap/ui/core/mvc/View with createContent)

Allowed when the UI must be built in code

JS view (sap.ui.jsview), JSON view, HTML view

Deprecated – know them for old apps only

A minimal XML view

<mvc:View
controllerName="my.products.controller.Main"
xmlns:mvc="sap.ui.core.mvc"
xmlns:core="sap.ui.core"
xmlns="sap.m">
<Page id="page" title="{i18n>title}">
<content>
<Label text="Product name" labelFor="nameInput"/>
<Input id="nameInput" value="{/name}" placeholder="Enter a name"/>
<Button text="Save" type="Emphasized" press=".onSave"/>
</content>
</Page>
</mvc:View>
  • controllerName links the controller; .onSave (leading dot) means a method of that controller.
  • XML basics: one root element, properly nested and closed tags, attribute values in quotes. A tag name is a control class (UpperCamelCase) or an aggregation (lowerCamelCase).

XML namespaces

An xmlns declaration maps a prefix to a namespace so element names are unique. In UI5 views the namespace is the library or package name: <t:Table> means class sap.ui.table.Table. The default namespace (no prefix, usually sap.m) is used for tags without a prefix.

Declaration

Library / package

Typical tags

xmlns="sap.m"

sap.m (default)

Page, Button, Input, List, Table

xmlns:mvc="sap.ui.core.mvc"

MVC classes

mvc:View, mvc:XMLView (nested view)

xmlns:core="sap.ui.core"

core

core:Item, core:Fragment, core:Icon, core:FragmentDefinition

xmlns:f="sap.f"

sap.f

f:DynamicPage, f:FlexibleColumnLayout, f:Card

xmlns:form="sap.ui.layout.form"

forms

form:SimpleForm, form:Form

xmlns:layout="sap.ui.layout"

layouts

layout:Grid, layout:Splitter

xmlns:t="sap.ui.table"

grid tables

t:Table, t:Column, t:columns, t:template

xmlns:unified="sap.ui.unified"

unified

unified:FileUploader, unified:Calendar

xmlns:microchart="sap.suite.ui.microchart"

micro charts (SAPUI5 only)

microchart:BulletMicroChart

Controllers and sap.ui.define

Every JavaScript file in a UI5 app (Component.js, controllers, formatters, custom controls) is an AMD module (Asynchronous Module Definition): sap.ui.define lists the dependencies by module name, UI5 loads them asynchronously and passes them to the factory function, whose return value is the module.

sap.ui.define([
"sap/ui/core/mvc/Controller",
"sap/ui/model/json/JSONModel",
"sap/m/MessageToast"
], (Controller, JSONModel, MessageToast) => {
"use strict";

return Controller.extend("my.products.controller.Main", {
onInit() {
this.getView().setModel(new JSONModel({ name: "" }));
},

onSave() {
const sName = this.byId("nameInput").getValue();
MessageToast.show(`Saved: ${sName}`);
}
});
});
  • Module name = class name with dots replaced by slashes: sap.m.MessageToast → "sap/m/MessageToast"; your own modules use your namespace: "my/products/model/formatter" (or relative: "../model/formatter").
  • Controller.extend("<fully qualified name>", { methods }) creates a subclass (JavaScript inheritance in UI5 uses extend). The name must match the file location and controllerName in the view.
  • sap.ui.require([...], callback) loads modules on demand inside code, without defining a module.
  • Never use globals such as new sap.m.Button() or jQuery.sap.*; always require the module. Modern JavaScript (arrow functions, const, template literals, async/await) is fine; TypeScript is supported through the UI5 TypeScript tooling.

Useful controller methods

Method

Returns

this.getView()

The view of this controller

this.byId("nameInput")

A control of this view by its view-local ID (same as this.getView().byId(...))

this.getOwnerComponent()

The component: .getRouter(), .getModel("i18n"), .getEventBus()

this.getView().getModel(name)

A model visible to the view (own or inherited from the component)

Control IDs

  • In an XML view the DOM ID of a control is prefixed with the view ID: <viewId>--<controlId> (e.g. application-products-component---main--nameInput). Use this.byId("nameInput"); never build the full ID yourself.
  • Never access UI5 controls through document.getElementById or jQuery: you get the DOM node, not the control object, and the DOM can be re-rendered at any time.
  • Global lookup of any control by its full ID: Element.getElementById(sId) (module sap/ui/core/Element). Legacy: sap.ui.getCore().byId(sId) (deprecated).

Lifecycle hooks

Controller lifecycle hooks: onInit once, onBeforeRendering and onAfterRendering on every rendering, onExit once

Hook

When

How often

ABAP analogy

Typical use

onInit

View instantiated, controls created, not yet rendered

Once per view instance

Constructor

Create view models, attach route patternMatched handlers, one-time setup

onBeforeRendering

Before the renderer writes the HTML

Every (re-)rendering

PBO

Last-minute changes to controls

onAfterRendering

HTML is in the DOM

Every (re-)rendering

–

Work that needs DOM elements: focus, sizes, third-party widgets

onExit

View is destroyed

Once

Destructor

Clean up: timers, EventBus subscriptions, objects you created yourself

  • A re-rendering happens when a control is invalidated (a property or aggregation changes), not each time the user looks at the screen. Modern UI5 often updates the DOM without a full re-rendering, so don't rely on the rendering hooks for business logic.
  • With routing a view is created once and then reused: logic that must run every time the page is shown belongs in the route's patternMatched handler (SAPUI5 › 04).

Part 8 – Controls

Anatomy of a control: properties, aggregations, associations and events, shown on a sap.m.Page with a Label and an Input

Member

What it is

Example

Property

A simple typed value (string, boolean, int, enum). UI5 generates getX() / setX() for every property; properties can be data-bound

text → getText() / setText(); Input.value

Aggregation

Child controls that the parent owns: it renders them and destroys them with itself; a child has only one parent. Cardinality 0..1 or 0..n

Page.content, List.items, Dialog.beginButton

Association

A loose reference by ID to a control that lives elsewhere; not owned, not rendered by the referencing control

Label.labelFor, ariaLabelledBy, Dialog.initialFocus

Event

Something the control fires; you attach a handler

Button.press, Input.change, Select.change

In general object-oriented modelling (UML) the words mean something else: an association is any relationship between classes, aggregation is a loose "has a" (parts can live alone) and composition a strong "owns" (parts die with the whole). A UI5 aggregation behaves like UML composition.

Rules for aggregations in XML

  • An aggregation tag starts in lower case and uses the prefix of its parent control: <t:Table> → <t:columns>, <t:template>.
  • If an aggregation is typed with a base class (sap.ui.core.Control, Element), any subclass can go into it: Page.content accepts any control.
  • Each control has at most one default aggregation whose tag may be omitted (content of Page, items of List and Select). Writing it explicitly is clearer.
  • Some aggregations accept an alternative type (altTypes): tooltip takes either a string or a tooltip control.

Simple controls and their key properties

Control (sap.m)

Key properties

Note

Label

text, labelFor, required, design

Always link it to its field with labelFor

Text

text, maxLines

Read-only text

Input

value, type (Text, Number, Email, Password), placeholder, valueState, editable

type="Password" masks the input

TextArea

value, rows, cols, growing

Multi-line input

CheckBox

selected, text

–

Switch

state, customTextOn, customTextOff

Yes/no toggle

Link

text, href, target

target="_blank" opens a new tab

Image

src, width, height, alt

–

RatingIndicator

value, maxValue

e.g. 4 of 5 stars

Slider

value, min, max, step

–

ProgressIndicator

percentValue, displayValue, state

e.g. 40 %

DatePicker / TimePicker / DateTimePicker

value, valueFormat, displayFormat, dateValue

Legacy: DateTimeInput (deprecated) → these three

StepInput

value, min, max, step

Number with +/- buttons

Controls with items (aggregation + inner element)

Control

Aggregation

Inner element

Inner properties

Selected value

Select (drop-down)

items

core:Item

key, text

selectedKey

ComboBox

items

core:Item

key, text

selectedKey, value

MultiComboBox

items

core:Item

key, text

selectedKeys

MultiInput

suggestionItems (+ tokens)

core:Item (Token)

key, text

tokens

RadioButtonGroup

buttons

RadioButton

text

selectedIndex

Tokenizer

tokens

Token

key, text

–

Breadcrumbs

links

Link

text, href, target

currentLocationText

List

items

StandardListItem …

title, description, icon

mode + getSelectedItem()

Table (sap.m)

columns + items

Column + ColumnListItem with cells

–

mode

Generic shape: <Control><aggregation><InnerElement property="value"/>…</aggregation></Control>. Items can be static (written in the view, as below) or dynamic through aggregation binding to a model or an OData entity set (SAPUI5 › 04).

<Label text="Country" labelFor="countrySelect"/>
<Select id="countrySelect" width="250px" selectedKey="IN" change=".onCountryChange">
<items>
<core:Item key="IN" text="India"/>
<core:Item key="CN" text="China"/>
<core:Item key="CA" text="Canada"/>
<core:Item key="US" text="United States"/>
<core:Item key="GB" text="United Kingdom"/>
</items>
</Select>

Control

Behaviour

Select

Pick exactly one value from the list; no typing

ComboBox

Pick from the list or type; typing filters the list. A typed value that is not in the list leaves selectedKey empty, so validate in the change event and set valueState

MultiComboBox

Pick several values from a list (check boxes)

MultiInput

Type and pick several values shown as tokens; suggestions pop up while typing. To turn free text into tokens add a validator or handle tokenUpdate

RadioButtonGroup

Exactly one of a few visible options; read getSelectedIndex() or getSelectedButton().getText() (RadioButton has no key property)

Breadcrumbs

Navigation trail showing where the user is: links to the parent levels plus currentLocationText for the current page

<RadioButtonGroup id="topicGroup" selectedIndex="0" select=".onTopicSelect">
<buttons>
<RadioButton text="SAPUI5"/>
<RadioButton text="SAP Fiori"/>
<RadioButton text="OData"/>
</buttons>
</RadioButtonGroup>

<Breadcrumbs currentLocationText="Laptop 15">
<links>
<Link text="Home" href="#/"/>
<Link text="Products" href="/notes/products/"/>
<Link text="Laptops" href="#/products?category=laptops"/>
</links>
</Breadcrumbs>

List item types

sap.m.List (extends ListBase) shows rows of list items in one column; its items aggregation takes any subclass of ListItemBase:

  • StandardListItem (title, description, icon, info) · ObjectListItem (title, number, attributes, statuses) · DisplayListItem (label + value) · InputListItem (label + an input control) · CustomListItem (any content) · ActionListItem (a button-like action) · FeedListItem (social feed entry) · ColumnListItem (a row of sap.m.Table).
  • List properties: mode (None, SingleSelectMaster, MultiSelect, Delete), growing + growingThreshold (load more rows on scroll), itemPress event with items of type="Navigation" or "Active".

sap.m.Table vs sap.ui.table.Table

sap.m.Table (responsive table)

sap.ui.table.Table (grid table)

Idea

A multi-column list; rows are ColumnListItems

Desktop grid with fixed rows and virtual scrolling

Aggregation for rows

items (template ColumnListItem with cells)

rows (each Column has a template)

Devices

Fully responsive: columns can pop in below the row on small screens (minScreenWidth, demandPopin)

Desktop-oriented; horizontal scrolling

Data volume

Small to medium; use growing to load more

Large data sets: renders only the visible rows

Columns without data

Column headers are shown even before data is bound

–

Typical use

Most Fiori apps, phone and tablet

Data-heavy desktop apps, TreeTable for hierarchies

Layout and page controls

Control

Use

sap.m.App, sap.m.NavContainer

Root container that shows one page at a time and animates navigation

sap.m.SplitApp

Master-detail container: list on the left (masterPages), details of the selected item on the right (detailPages), e.g. sales orders or materials. A worklist is different: a full-screen list in an sap.m.App that opens a detail page (SAP Fiori › 03)

sap.f.FlexibleColumnLayout

Modern list-detail-detail layout with up to three columns

sap.m.Page, sap.f.DynamicPage

A screen with header, content and footer; DynamicPage has a collapsible header with filters

sap.m.VBox, HBox, FlexBox

Stack controls vertically or horizontally

sap.ui.layout.form.SimpleForm

Label + field pairs in a responsive grid: the standard way to show or edit one record

sap.m.IconTabBar

Tabs within a page

ObjectHeader, ObjectStatus, ObjectNumber, ObjectIdentifier

Show a business object's title, status (with colour) and amounts

SearchField, MessageStrip, Toolbar, OverflowToolbar

Search, inline messages, button bars

<form:SimpleForm editable="true" layout="ResponsiveGridLayout" title="Product">
<form:content>
<Label text="Name"/>
<Input value="{/name}"/>
<Label text="Available"/>
<Switch state="{/available}"/>
<Label text="Rating"/>
<RatingIndicator value="{/rating}" maxValue="5"/>
<Label text="Release date"/>
<DatePicker value="{/releaseDate}" valueFormat="yyyy-MM-dd"/>
</form:content>
</form:SimpleForm>
  • Custom controls (your own control class with its renderer) → see SAPUI5 › 05 · UI5 Tooling, TypeScript & Custom Controls.

Part 9 – Events

Attach a handler in XML with the event name as attribute and a controller method as value: press=".onSave". UI5 calls the method with an event object (sap.ui.base.Event).

Method on the event object

Returns

oEvent.getSource()

The control that fired the event

oEvent.getParameter("name")

One event parameter, e.g. selectedItem of Select.change, query of SearchField.search, listItem of List.itemPress

oEvent.getParameters()

All parameters as an object; each event documents its parameters in the API reference

onCountryChange(oEvent) {
const oItem = oEvent.getParameter("selectedItem");    // core:Item that was chosen
MessageToast.show(`${oItem.getKey()} – ${oItem.getText()}`);
},

onItemPress(oEvent) {
const oItem = oEvent.getSource();                         // the pressed ColumnListItem
const oProduct = oItem.getBindingContext().getObject();   // its data record
this.getOwnerComponent().getRouter().navTo("detail", { productId: oProduct.id });
}
  • Attach in code: oButton.attachPress(this.onSave, this); detach with detachPress. Custom controls fire their own events with fireEvent / generated fireX methods.
  • EventBus for loose communication between controllers: this.getOwnerComponent().getEventBus() with subscribe(channel, event, handler, this) and publish(channel, event, data); unsubscribe in onExit.
  • Routing events (patternMatched) are on SAPUI5 › 04 · Data, Binding & Navigation.

Part 10 – Modern UI5: asynchronous APIs and the UI5 2.x path

UI5 has grown for more than ten years, so the API reference still contains many old APIs. Most of them are synchronous (they block the browser while a file loads) or rely on globals. They are deprecated in 1.x and removed in UI5 2.x. Every new line of code should use the modern replacement, and interviewers like to ask for it. Why synchronous loading hurts is shown on SAPUI5 › 02, Part 13.

Legacy (deprecated)

Modern replacement

Module

jQuery.sap.require / declare, globals such as sap.m.Button

sap.ui.define([...], factory), sap.ui.require([...], callback)

–

sap.ui.requireSync(...)

Declare the dependency, or sap.ui.require([...], callback)

–

sap.ui.xmlview(...)

await XMLView.create({ viewName })

sap/ui/core/mvc/XMLView

sap.ui.xmlfragment(...)

this.loadFragment({ name }) or Fragment.load({...})

sap/ui/core/Fragment

sap.ui.component(...)

await Component.create({ name, manifest: true })

sap/ui/core/Component

sap.ui.getCore().byId(id)

this.byId(id) in a controller; Element.getElementById(id) globally

sap/ui/core/Element

sap.ui.getCore().attachInit(fn)

Core.ready(fn) or await Core.ready()

sap/ui/core/Core

sap.ui.getCore().getMessageManager()

Messaging (addMessages, removeAllMessages, message model)

sap/ui/core/Messaging

sap.ui.getCore().applyTheme(t)

Theming.setTheme(t)

sap/ui/core/Theming

sap.ui.getCore().loadLibrary(l)

await Lib.load({ name: l })

sap/ui/core/Lib

sap.ui.getCore().getConfiguration().getLanguage()

Localization.getLanguage()

sap/base/i18n/Localization

sap.ui.getCore().getEventBus()

this.getOwnerComponent().getEventBus() or EventBus.getInstance()

sap/ui/core/EventBus

sap.ui.getCore().setModel(m)

Models in the manifest or on the component

–

JS, JSON and HTML views

XML views (or typed views)

–

jQuery.sap.log, jQuery.sap.delayedCall …

Log, setTimeout, helpers in sap/base/util/*

sap/base/Log

Settings that make an app asynchronous

  • Bootstrap: data-sap-ui-async="true", data-sap-ui-compat-version="edge", and the app started through ComponentSupport (no inline script).
  • Component: the interface sap.ui.core.IAsyncContentCreation (or "async": true in sap.ui5/rootView and sap.ui5/routing/config). In UI5 2.x asynchronous root view and routing are implied and the synchronous variants are errors.
  • Libraries: list them in sap.ui5/dependencies/libs so they are preloaded asynchronously; mark rarely used ones "lazy": true and load them with Lib.load when needed.
  • Themes: sap_horizon (or sap_fiori_3); Belize and Blue Crystal are no longer delivered.

How to find and fix legacy code

  • Run the UI5 linter (npx @ui5/linter, command ui5lint): it reports deprecated APIs, global access, synchronous loading and deprecated manifest entries in JS, TS, XML, HTML and JSON files, and can fix part of them automatically (ui5lint --fix).
  • The Support Assistant (Part 12) finds runtime problems, such as synchronous requests, that a static check cannot see. Each deprecated API in the API reference names its replacement.
  • Linter setup, performance rules and the full best-practice checklist → see SAPUI5 › 05 · UI5 Tooling, TypeScript & Custom Controls and SAPUI5 › 06 · Testing, Performance & Best Practices.

Part 11 – Putting it together: the Sales Order Approval dashboard

The Sales Order Approval business from the RAP and CAP sections already has a Fiori elements list report for the reps and an approver app. Managers also want a dashboard on one screen: KPI numbers, the orders waiting for approval, quick Approve/Reject buttons and a detail page. That layout is not a standard floorplan, so it is built as a freestyle UI5 app on the same OData V4 service ZUI_SalesOrder_O4 (RAP) or /odata/v4/manager (CAP). Check first whether Fiori elements with the flexible programming model covers the need (→ see SAP Fiori › 04 · SAP Fiori Tools & Flexible Programming Model).

Sales Order Approval dashboard: DynamicPage with KPI header, search and status filter, sales order table with status colours, Approve and Reject buttons; back end, pages and files of the app

Piece

In the dashboard

Explained in

Start

Launchpad intent #SalesOrder-approve; index.html only for local runs

Part 5

Component + manifest

my.sodashboard.Component; data source mainService (OData 4.0); models "" (V4) and i18n; routes dashboard and order

Part 6

Root view

App.view.xml with sap.f.FlexibleColumnLayout (list left, order right) or sap.m.App

Parts 7–8

Dashboard view

sap.f.DynamicPage: title, SearchField, sap.m.Table bound to /SalesOrder

Part 8

Controller

onSearch, onUpdateFinished (count), onItemPress → navTo("order")

Parts 7 and 9

Formatter, i18n

status N / A / R → text and ObjectStatus state

SAPUI5 › 04, Parts 5–6

Approve / Reject

bound actions, side effects, Reject dialog fragment

SAPUI5 › 04, Parts 10 and 13

<!-- view/Dashboard.view.xml (excerpt; property names as in your service) -->
<f:DynamicPage id="dashboardPage">
<f:title>
<f:DynamicPageTitle>
<f:heading><Title text="{i18n>dashboardTitle}"/></f:heading>
</f:DynamicPageTitle>
</f:title>
<f:content>
<Table id="orderTable" growing="true" growingThreshold="20" updateFinished=".onUpdateFinished"
items="{ path: '/SalesOrder', parameters: { $count: true },
filters: [{ path: 'Status', operator: 'EQ', value1: 'N' }] }">
<headerToolbar>
<OverflowToolbar>
<Title id="orderTitle"/>
<ToolbarSpacer/>
<SearchField width="15rem" search=".onSearch"/>
</OverflowToolbar>
</headerToolbar>
<columns>
<Column><Text text="{i18n>order}"/></Column>
<Column><Text text="{i18n>customer}"/></Column>
<Column hAlign="End"><Text text="{i18n>netAmount}"/></Column>
<Column><Text text="{i18n>status}"/></Column>
</columns>
<items>
<ColumnListItem type="Navigation" press=".onItemPress">
<ObjectIdentifier title="{SalesOrderID}"/>
<Text text="{CustomerName}"/>
<ObjectNumber number="{NetAmount}" unit="{Currency}"/>
<ObjectStatus text="{ path: 'Status', formatter: '.formatter.statusText' }"
state="{ path: 'Status', formatter: '.formatter.statusState' }"/>
</ColumnListItem>
</items>
</Table>
</f:content>
</f:DynamicPage>
// controller/Dashboard.controller.js (excerpt)
sap.ui.define([
"./BaseController",
"../model/formatter",
"sap/ui/model/Filter",
"sap/ui/model/FilterOperator"
], (BaseController, formatter, Filter, FilterOperator) => {
"use strict";
return BaseController.extend("my.sodashboard.controller.Dashboard", {
formatter,

onUpdateFinished(oEvent) {                         // after each (growing) load
const iTotal = oEvent.getParameter("total");     // from $count
this.byId("orderTitle").setText(this.getResourceBundle().getText("waitingCount", [iTotal]));
},

onSearch(oEvent) {                                 // ANDed with the status filter of the view
const sQuery = oEvent.getParameter("query");
const aFilters = sQuery ? [new Filter("CustomerName", FilterOperator.Contains, sQuery)] : [];
this.byId("orderTable").getBinding("items").filter(aFilters);
},

onItemPress(oEvent) {
const sId = oEvent.getSource().getBindingContext().getProperty("SalesOrderID");
this.getRouter().navTo("order", { id: encodeURIComponent(sId) });
}
});
});
  • Filters written in the binding info of the view are application filters; filter(aFilters) from the controller sets control filters, and the model combines both with AND – so the search never shows approved orders.
  • getResourceBundle() and getRouter() are helpers of the BaseController (Part 4).
  • Approve and Reject (bound actions), the detail page binding and side effects → see SAPUI5 › 04 · Data, Binding & Navigation, Part 10. Tests for the dashboard → SAPUI5 › 06.

Part 12 – Debugging and useful links

Tool

How

What it shows

Diagnostics window

Ctrl+Alt+Shift+S

Control tree with properties and bindings, debugging options, performance

Technical Information

Ctrl+Alt+Shift+P

UI5 version, loaded libraries, app info; switch to debug sources; start the Support Assistant

Support Assistant

From Technical Information, or URL parameter sap-ui-support=true

Rule-based check of the app: deprecated APIs, performance, accessibility, binding errors

UI5 Inspector

Browser extension for Chrome / Edge

Control tree, properties, bindings and models of the running app

Debug sources

URL parameter sap-ui-debug=true

Loads the non-minified sources so breakpoints are readable

Browser DevTools (F12)

Console, Sources, Network

Errors and logs; the Network tab shows OData requests and $batch contents

  • Typical first checks: console errors (missing module, wrong controllerName), the Network tab (404 on a file, OData error responses), and the Diagnostics binding info when a field stays empty.
  • Backend errors of OData services are analysed on the server (e.g. /IWFND/ERROR_LOG, /IWFND/GW_CLIENT); see CORE ABAP › 08 OData.

Useful public links

Site

URL

Use

SAPUI5 SDK (Demo Kit)

https://ui5.sap.com (older address: sapui5.hana.ondemand.com)

API reference, Samples, Developer Guide, Walkthrough tutorial

OpenUI5 SDK

https://sdk.openui5.org

Same for the open-source edition

SAP Fiori apps reference library

https://fioriappslibrary.hana.ondemand.com

All standard SAP Fiori apps: app ID, technical details, required components, roles

SAP Fiori design guidelines

https://www.sap.com/design-system/fiori-design-web/ (formerly experience.sap.com/fiori-design-web)

Floorplans, controls, UX patterns

UI5 CLI documentation (formerly UI5 Tooling)

https://ui5.github.io/cli (old address: sap.github.io/ui5-tooling)

CLI commands, ui5.yaml, middlewares

  • Prerequisites for learning UI5: HTML, CSS and JavaScript (SAPUI5 › 01 and 02), plus basic REST/OData knowledge. ABAP helps for the backend side; CAP (Node.js or Java) is the BTP alternative.

Part 13 – Interview questions

Q1. What is SAPUI5, and how does it differ from OpenUI5 and UI5 Tooling?

SAPUI5 is SAP's HTML5/JavaScript UI framework for responsive enterprise web apps that follow the SAP Fiori design. OpenUI5 is its open-source core (Apache 2.0); SAPUI5 adds licensed libraries such as charts, smart controls and Fiori elements. UI5 Tooling is the Node.js CLI (ui5 serve, ui5 build) for developing UI5 projects.

Q2. What is bootstrapping, and which attributes matter?

Loading and initialising the UI5 core through the sap-ui-bootstrap script tag that loads sap-ui-core.js. Key attributes: src (CDN or local), theme, resource-roots (namespace → folder), async="true", on-init (e.g. ComponentSupport) and compat-version. In the launchpad there is no index.html: the launchpad bootstraps UI5 and starts the component.

Q3. Why does every app need Component.js and manifest.json?

The component is the app's entry point and the unit the Fiori launchpad starts; it extends UIComponent and provides the router. The manifest declares the app's ID, data sources, models, libraries, root view and routing, so the framework creates them automatically (manifest-first). Without a component an app cannot be embedded in the launchpad.

Q4. Name the main sections of manifest.json.

sap.app (ID, title, i18n, dataSources, crossNavigation), sap.ui (technology, device types), sap.ui5 (rootView, dependencies, models, routing, resources), sap.fiori (registration IDs, archetype) and platform sections such as sap.cloud for BTP.

Q5. Explain MVC in UI5. Can one view have two controllers?

The model holds data, the view renders the UI, and the controller handles events and changes model and view; binding keeps model and view in sync. A view has at most one controller; one controller class can be reused by several views, and views without a controller are allowed. Best practice: one controller per view, same name.

Q6. Why are XML views recommended? Which view types are deprecated?

XML views are declarative and enforce the separation of UI and logic; they have the best tool support and are required for key user adaptation, extension points and XML templating (Fiori elements). JS, JSON and HTML views are deprecated; typed views are the programmatic alternative.

Q7. What are the controller lifecycle hooks, and in which order do they run?

onInit (once, controls exist), onBeforeRendering and onAfterRendering (on every rendering), onExit (once, on destroy). Create models and attach route handlers in onInit; clean up in onExit; per-display logic goes into the route's patternMatched handler.

Q8. What is the difference between an aggregation and an association?

An aggregation is a parent-child relationship: the parent owns, renders and destroys its children (Page.content, List.items). An association is only a reference by ID to a control that lives elsewhere (Label.labelFor, ariaLabelledBy).

Q9. How do you get a control in a controller? What is its DOM ID?

this.byId("localId") (or this.getView().byId). In XML views the DOM ID is <viewId>--<localId>. Never use document.getElementById; for a global lookup by full ID use Element.getElementById (sap.ui.getCore().byId is deprecated).

Q10. What does sap.ui.define do, and how is it different from sap.ui.require?

sap.ui.define defines an AMD module: it declares dependencies, loads them asynchronously and returns the module (controller, component, formatter). sap.ui.require only loads modules on demand inside code without defining a module. Module names are class names with slashes: sap/m/Button.

Q11. Select vs ComboBox vs MultiComboBox vs MultiInput?

Select: choose one value, no typing. ComboBox: choose or type one value (validate free text). MultiComboBox: choose several values from a list. MultiInput: type with suggestions and collect several values as tokens. All use items (MultiInput: suggestionItems) with core:Item key/text.

Q12. How do you find the UI5 version of a running app and debug it?

Ctrl+Alt+Shift+P opens Technical Information (version, libraries, debug sources, Support Assistant); Ctrl+Alt+Shift+S opens the Diagnostics window. Add sap-ui-debug=true for readable sources, use the UI5 Inspector extension and the browser's Network tab for OData calls.

Q13. Name five deprecated UI5 APIs and their modern replacements.

jQuery.sap.require → sap.ui.define / sap.ui.require([...], cb); sap.ui.getCore().byId → this.byId or Element.getElementById; sap.ui.xmlview → XMLView.create; sap.ui.xmlfragment → loadFragment / Fragment.load; sap.ui.getCore().attachInit → Core.ready(); getMessageManager → Messaging; sap.ui.component → Component.create. All modern variants are asynchronous and return promises; the old ones are removed in UI5 2.x.

Q14. Scenario: an old app uses jQuery.sap.require, sap.ui.getCore().byId and a JS view. How do you prepare it for UI5 2.x?

Run the UI5 linter to list every finding and apply its autofixes. Convert modules to sap.ui.define with declared dependencies, replace getCore() calls with the dedicated modules (Element, Core.ready, Messaging, Theming, Lib), rewrite the JS view as an XML view, and make the bootstrap and manifest asynchronous (async="true", IAsyncContentCreation, async routing). Switch Belize to Horizon. Then test with the Support Assistant and the app's QUnit/OPA tests.

Q15. Scenario: why build the Sales Order Approval dashboard as a freestyle app, and how is it structured?

Fiori elements covers list report, object page and worklist floorplans; a one-screen dashboard with KPIs, quick actions and a free layout is not a standard floorplan (check the flexible programming model first). Structure: Component.js + manifest (V4 data source, i18n, routing), an App root view with a FlexibleColumnLayout, a Dashboard view (DynamicPage + table bound to /SalesOrder with a status filter), an OrderDetail view, a BaseController, a formatter for status text and colour, and a Reject dialog fragment. Approve/Reject call the service's bound actions.

🏠 Start Here · ◀ 02 · JavaScript & Node.js · 04 · Data & Navigation ▶ · Sections: CORE ABAP | OOPS ABAP | ABAP on HANA | Clean Core | RAP | ABAP Points | SAP Fiori | SAPUI5 | Mobile Development (MDK) | BTP Foundations | BTP Development | CAP | SAP Build | ABAP on BTP | Integration Suite | SAP Business AI | SAP BASIS | Security | SAP SDLC

Functional: FICO ABAP | TRM ABAP | VIM | SAP BIS | SD ABAP | MM ABAP | PP ABAP | QM ABAP | PM ABAP | PS ABAP | EWM | TM ABAP | GTM ABAP | EHS ABAP | HR ABAP | BW | SAP Datasphere | SAP Business Data Cloud | SAP MDG | SAP Analytics Cloud | SAP Ariba | SAP CX | SAP IBP