SAPUI5 and Fiori Tools Part 5: OData V4 Read, Create, Update and Errors
Preview · a free account unlocks the full lesson
Work with a RAP OData V4 service from SAPUI5: configure the V4 model, read lists and single entities with $select, create with list bindings, update with two-way binding, submit batch groups and handle errors and messages.
In this lessonShow sectionsHide sections
Visual overview
Explanation
Part 3 introduced binding. Now it's time to build the data layer of a freestyle app on the RAP service ZAPI_PURCHREQ (V4, no draft) — or a UI service if the app uses draft instead.
Configuring the model happens in manifest.json. Under "sap.app", the dataSources section needs a mainService entry with the uri (the service root) and type "OData" with odataVersion "4.0". Under "sap.ui5", the models section needs a default model, named "", with dataSource set to "mainService" and settings such as operationMode: "Server", autoExpandSelect: true, and an updateGroupId. autoExpandSelect is particularly valuable because it builds $select and $expand automatically from the bindings in use, which is a significant performance win.
Reading data works through bindings rather than manual requests. A list uses something like <Table items="{path: '/PurchaseRequest', parameters: {$orderby: 'RequestID desc', $count: true}}">, while a single entity uses view.bindElement("/PurchaseRequest(RequestUUID=…)"). Filtering and sorting are applied with sap.ui.model.Filter and sap.ui.model.Sorter on the list binding, and both execute on the server rather than the client.
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.