Skip to content

Lesson 1 companion — How the first app fits together ​

Guided lesson · Assignment

Use this page while following the guide or catching up. It explains the patterns behind the complete files; the short snippets below are illustrations, not whole replacement files.

1. Keep these ideas distinct ​

TermMeaning in this course
SAP FioriThe UX approach and design system for business applications.
SAPUI5The JavaScript framework used to build the interface.
SAP Fiori elementsAn approach built on SAPUI5 that uses service metadata and annotations to create standard application patterns.
Local previewA development server on your computer; it is not a deployed SAP business service.

In this lesson you create a small freestyle SAPUI5 app. No database or business-data service is involved.

2. Find the right file ​

FileWhat to look for
package.jsonnpm start and the development tooling.
webapp/manifest.jsonApplication ID, dependencies and the generated shell/routing configuration.
webapp/view/Main.view.xmlVisible controls and event-handler names.
webapp/controller/Main.controller.jsThe behavior that runs after an interaction.

The wizard prefix training.fiori plus module name day1 produces the app ID training.fiori.day1. Keep that identity consistent. Renaming your outer working folder does not require changing the namespace.

3. Trace a button press ​

xml
<Button id="sayHelloButton" text="Say Hello" press=".onSayHello" />

The View creates a Button. Its text property supplies the visible label. Its press event points to a Controller method; the leading dot asks UI5 to resolve that method on this View's Controller.

javascript
onSayHello: function () {
    MessageToast.show("Hello from SAPUI5!");
}

The handler calls the imported MessageToast module. It does not need to find or edit a browser HTML button. In the complete file, sap/m/MessageToast in the dependency array corresponds to MessageToast in the callback parameters.

4. Names and IDs to recognize ​

ExamplePurpose
training.fiori.day1.controller.MainDotted Controller class name.
sap/m/MessageToastSlash-based module dependency, without .js.
sayHelloButtonSemantic local control ID.
.onSayHelloController event-handler reference in XML.

UI5 prefixes local IDs with the View's identity. Use meaningful local IDs rather than copying long IDs from browser HTML. Stable naming supports later lookup, testing and adaptation.

5. Diagnose the first failure ​

SymptomFirst check
The page fails to loadConsole and the first failed Network request; check the Controller namespace and filename.
A button is visible but does nothingCompare its event attribute and method name, including case.
MessageToast is undefinedMatch the dependency array with the callback parameter order.
Edits do not appearSave the file; check the folder served by the running terminal; reload.

Change one cause at a time. A blank page and a disconnected button usually need different investigations.

6. Check yourself ​

Before opening the answer, explain what changes if you edit only the Button's text property.

Compare your explanation

The visible button label changes. The handler and toast stay the same because press still points to the same method. To change the toast, edit the message passed to MessageToast in the Controller.

7. Recover and continue ​

Generate and configure your project using Lesson 1's setup steps. Use the completed checkpoint to compare the Hello interaction if needed. Confirm the original button works before beginning the welcome-page assignment. Keep the guided lesson folder for Lesson 2.

8. Official documentation and examples ​

These SAPUI5 links target 1.148.12, the version used by the supplied apps. References checked on 15 November 2026.

ReferenceUse it to answer
SAPUI5 Demo Kit and examplesWhere can I inspect controls, APIs and runnable samples?
Button APIWhich properties and events does Button provide?
MessageToast APIWhat does show do?
SAPUI5 developer best practicesHow should dependencies and Controller handlers be declared?
SAPUI5 ID handlingWhy assign semantic IDs and let UI5 prefix them?
SAP's Fiori application generatorHow does the generator create the project?

Independent learning materials for SAP frontend development.