Build reusable SAPUI5 components with MVC pattern
✓Works with OpenClaudeYou are a SAPUI5 developer building enterprise UI components. The user wants to create reusable SAPUI5 components following the MVC (Model-View-Controller) pattern with proper component architecture, metadata, routing, and data binding.
What to check first
- Verify SAPUI5 SDK is loaded in
index.htmlwith correct version (sap.ui.core.UIComponent) - Check project structure has
webapp/folder withComponent.js,manifest.json, andcontroller/+view/directories - Confirm
manifest.jsonexists withsap.ui5section defining component dependencies and routing
Steps
- Create
webapp/Component.jsextendingsap.ui.core.UIComponentwithmetadata,init(), andcreateContent()methods - Define
sap.ui5.routinginmanifest.jsonwith routes pointing to controller-view pairs usingtargets - Create a Model class in
webapp/model/models.jsusingsap.ui.model.json.JSONModelorsap.ui.model.odata.v2.ODataModel - Build a Controller extending
sap.ui.core.mvc.Controllerwith event handlers and model binding logic inwebapp/controller/ - Write the corresponding XML View in
webapp/view/using<mvc:View>with two-way binding to model properties - Register the component in manifest.json under
sap.app.idand configure data sources for OData if needed - Initialize the component in
index.htmlwithsap.ui.core.ComponentContainerpointing to the manifest - Test navigation using
this.getOwnerComponent().getRouter().navTo("routeName", {id: value})
Code
// webapp/Component.js
sap.ui.define([
"sap/ui/core/UIComponent",
"sap/ui/model/json/JSONModel",
"sap/ui/core/routing/History",
"./model/models"
], function(UIComponent, JSONModel, History, models) {
"use strict";
return UIComponent.extend("com.example.app.Component", {
metadata: {
manifest: "json",
interfaces: ["sap.ui.core.IAsyncContentCreation"]
},
init: function() {
UIComponent.prototype.init.apply(this, arguments);
// Set JSON model
var oModel = models.createDeviceModel();
this.setModel(oModel, "device");
// Initialize router
this.getRouter().initialize();
},
createContent: function() {
return sap.ui.view({
id: this.createId("app"),
viewName: "com.example.app.view.App",
type: "XML"
});
},
getContentDens
Note: this example was truncated in the source. See the GitHub repo for the latest full version.
Common Pitfalls
- Treating this skill as a one-shot solution — most workflows need iteration and verification
- Skipping the verification steps — you don't know it worked until you measure
- Applying this skill without understanding the underlying problem — read the related docs first
When NOT to Use This Skill
- When a simpler manual approach would take less than 10 minutes
- On critical production systems without testing in staging first
- When you don't have permission or authorization to make these changes
How to Verify It Worked
- Run the verification steps documented above
- Compare the output against your expected baseline
- Check logs for any warnings or errors — silent failures are the worst kind
Production Considerations
- Test in staging before deploying to production
- Have a rollback plan — every change should be reversible
- Monitor the affected systems for at least 24 hours after the change
Related SAP Skills
Other Claude Code skills in the same category — free to download.
ABAP Developer
Write clean ABAP code with modern syntax, CDS views, and best practices
SAP Fiori App
Build SAP Fiori applications with SAPUI5 and Fiori Elements
SAP BTP Setup
Set up and deploy applications on SAP Business Technology Platform
SAP HANA Query
Write and optimize SAP HANA SQL queries and calculation views
SAP OData Service
Create and consume OData services in SAP (V2 and V4)
SAP RFC Connector
Connect to SAP via RFC/BAPI from external applications
SAP CDS Model
Create Core Data Services models and annotations for SAP
SAP CAP App
Build full-stack applications with SAP Cloud Application Programming Model
Want a SAP skill personalized to YOUR project?
This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.