SAPUI5 and Fiori Tools Part 4: Routing, Navigation, Fragments and Dialogs
Preview · a free account unlocks the full lesson
Add navigation to a freestyle SAPUI5 app: configure routes and targets in manifest. json, navigate with parameters, read them in the target view, and reuse UI with fragments and dialogs.
In this lessonShow sectionsHide sections
Visual overview
Explanation
Routes, which are URL patterns, and targets, which are views, are configured in manifest.json rather than in code. Navigation happens via oRouter.navTo("detail", { requestId }), and parameters are read back in attachPatternMatched. Fragments are reusable pieces of UI without their own controller, and dialogs are usually built as fragments. One rule to keep in mind: always bind the detail view inside the pattern-matched handler, never in onInit.
Parts 1 through 3 built views, models and data binding for a single page. Real apps have several pages, so this part adds list-to-detail navigation and a dialog to the purchase request app.
A few routing concepts underpin all of this. The router reads the URL hash and shows the right view accordingly. A route is a name paired with a URL pattern — for example "detail" with pattern "requests/{requestId}". A target specifies which view to display and where, meaning which control aggregation of the app container it goes into. The URL hash itself, something like #/requests/4711, is what makes pages bookmarkable and lets the browser's back button work.
All of this routing configuration lives under "sap.ui5" → "routing" in manifest.json: a config section (router class, view type, path, controlId, controlAggregation), plus the routes and targets themselves. Fiori tools generators create this structure for you initially, and you add routes to it as the app grows.
Create a free account to keep reading
You have read the opening of this lesson. A free ERPClimb account unlocks the rest of it, every other lesson and topic, and your learning history, so you can pick up exactly where you stopped. No card needed.
- Full explanation
- Code example
- Real project scenario
- Common mistakes
- Best practices
- Interview angle
One tap with Google works too. Every topic keeps its first lesson open to everyone.
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.