ERPClimb logoERPClimb
Fiori Elements
RAP / CDS / ODataintermediate 8 min read

Fiori Elements Part 4: Extending Apps with the Flexible Programming Model

Lessons are open to try during our launch period. Some advanced content may move to Pro later. AI practice limits apply separately.

Key takeaway

Learn how to add custom logic, actions, and UI fragments to a generated Fiori Elements app without breaking the annotation-driven contract, using the flexible programming model's controller extensions and extension points.

In this lessonShow sections

Visual overview

Fiori Elements Part 4: Extending Apps with the Flexible Programming Model — learning sheetFlow: Confirm the requirement cannot be met with annotations → Use the Page Map to add a custom section or action → Implement the fragment/controller, calling the OData V4 model or a RAP action → Test with draft and with a user without authorization. Key ideas: WHAT THE FLEXIBLE PROGRAMMING MODEL IS; EXTENSION POINTS; CONFIGURATION; WHERE LOGIC BELONGS. Watch out: Prefer annotations first — extend only for what annotations cannot express.ERPClimb.com / RAP / LESSON 4/5 / LEARNING SHEETFiori Elements Part 4: Extending Apps with the FlexibleProgramming Model1 · HOW IT FLOWS1Confirm therequirementcannot be met…2Use the Page Mapto add a customsection or…3Implement thefragment/controller,calling the…4Test with draftand with a userwithout…2 · KEY IDEAS EXPLAINEDWhat The Flexible Programming Model IsAvailable for Fiori Elements on OData V4.Mix generated floorplans with custom UI5 fragmentsand controller code at defined extension points.Extension PointsCustom section on the object page (a fragment withyour own content).Custom column in a table (e.g. a chart or specialformatting).ConfigurationExtensions are registered in manifest.json underthe page target's settings (content → body →sections / controlConfiguration / actions).SAP Fiori tools Page Map generates the entries andstubs.Where Logic BelongsBusiness rules stay in the RAP BO (validations,determinations, feature control).UI extension code only presents or orchestrates.3 · REMEMBER · WATCH OUTRememberThe flexible programming model lets you extend Fiori Elements withoutleaving the floorplan.Extension points: custom sections, custom columns, custom actions,controller extensions.Configure extensions in manifest.json; keep code small and indedicated fragments/controllers.!Watch outPrefer annotations first — extendonly for what annotations cannotexpress.4 · IN A REAL PROJECTOn a sales order management RAP app, business asked for an 'Escalate to Manager' button that appears only fororders over a threshold value and in 'Pending' status, sends a custom action to update escalation flag and loga note, then automatically refreshes the approval status field and re-evaluates the exception icon in the list…Original ERPClimb learning sheet • Verify against your SAP release and edition

Expert visual walkthrough

RAP · CDS · ODATA ACADEMY · Architecture hierarchyERPClimb.com

Extending Apps with the Flexible Programming Model

Fiori Elements · Chapter-specific technical teaching map

Architecture hierarchy

1Top level

App view

2Related level

Controller / model

3Related level

OData binding

4Related level

Backend service

Tutor's chapter takeaway

Learn how to add custom logic, actions, and UI fragments to a generated Fiori Elements app without breaking the annotation-driven contract, using the flexible programming model's controller extensions and extension points.

In a real project

On a sales order management RAP app, business asked for an 'Escalate to Manager' button that appears only for orders over a threshold value and in 'Pending' status, sends a custom action to update escalation flag and log a…

Watch out for

• Implementing an entire custom action in JavaScript on the frontend instead of exposing it as a proper RAP custom action, bypassing draft and authorization consistency checks • Forgetting Common.SideEffects annotations after…

Conceptual study map, not an SAP configuration screenshot or a guaranteed runtime sequence. Consult the lesson for implementation prerequisites and exceptions.

The situation: a real project scenario

On a sales order management RAP app, business asked for an 'Escalate to Manager' button that appears only for orders over a threshold value and in 'Pending' status, sends a custom action to update escalation flag and log a note, then automatically refreshes the approval status field and re-evaluates the exception icon in the list report line.

Explanation

Part 3 covered what annotations can do. Some requirements go beyond them, and the flexible programming model handles those without ever leaving the Fiori Elements floorplan.

The flexible programming model is available for Fiori Elements on OData V4, and it lets generated floorplans be mixed with custom UI5 fragments and controller code at defined extension points, while the app still stays a genuine Fiori Elements app — floorplan updates continue to apply as usual.

Several extension points are available: a custom section on the object page, built as a fragment with its own content; a custom column in a table, for something like a chart or special formatting; a custom action in a toolbar or header, handled by a controller; controller extensions, such as onBeforeSave hooks, for lifecycle logic; and building blocks, or macros, like Table, Chart and Field, usable inside custom sections.

Configuration happens in manifest.json, where extensions get registered under the page target's settings — content, body, sections, controlConfiguration, actions. SAP Fiori tools' Page Map generates these entries and stubs automatically, and each extension is best kept in its own fragment or controller file.

Where the logic belongs matters a great deal: business rules stay in the RAP BO — validations, determinations, feature control — while UI extension code should only present or orchestrate. A custom action that changes data should call a RAP action rather than ever writing data itself.

Annotations should always come first: before reaching for an extension, the annotation reference should be checked for a standard solution, since every extension is code that has to be tested and maintained through each UI5 upgrade — and it's worth documenting why a given extension was actually needed.

In practice: confirm the requirement genuinely can't be met with annotations, use the Page Map to add a custom section or action, implement the fragment or controller calling the OData V4 model or a RAP action, and test both with draft and with a user who lacks authorization. With that, the custom section appears on the object page and the standard Edit/Save flow still works as expected.

Code example

ABAP Code
// ===== manifest.json: custom section on the object page (flexible programming model) ====="sap.ui5": {  "routing": {    "targets": {      "PurchaseRequestObjectPage": {        "type": "Component",        "name": "sap.fe.templates.ObjectPage",        "options": {          "settings": {            "contextPath": "/PurchaseRequest",            "content": {              "body": {                "sections": {                  "approvalHistory": {                        // custom section                    "template": "zpurchreq.ext.fragment.ApprovalHistory",                    "title": "Approval History",                    "position": { "placement": "After", "anchor": "Items" }  // anchors the custom section relative to a standard one by its facet id                  }                }              }            },            "controlConfiguration": {              "_Item/@com.sap.vocabularies.UI.v1.LineItem": {                "actions": {                  "checkStock": {                             // custom table action                    "press": "zpurchreq.ext.controller.ItemActions.onCheckStock",                    "text": "Check Stock",                    "requiresSelection": true                 // button stays disabled until at least one row is selected                  }                }              }            }          }        }      }    }  }} <!-- ===== ext/fragment/ApprovalHistory.fragment.xml ===== --><core:FragmentDefinition xmlns:core="sap.ui.core" xmlns="sap.m">  <List items="{path: '_ApprovalLog', parameters: {$orderby: 'ChangedAt desc'}}">    <StandardListItem title="{ApprovedBy}" description="{Comment}" info="{ChangedAt}" />  </List></core:FragmentDefinition> // ===== ext/controller/ItemActions.js =====sap.ui.define(["sap/m/MessageToast"], function (MessageToast) {  "use strict";  return {    onCheckStock: function (oContext, aSelectedContexts) {      // keep logic small; business checks belong in a RAP action      MessageToast.show(aSelectedContexts.length + " item(s) checked");    }  };}); // Rule: annotations first -> building blocks / extensions only for the rest

Watch out

Common mistakes

  • Implementing an entire custom action in JavaScript on the frontend instead of exposing it as a proper RAP custom action, bypassing draft and authorization consistency checks
  • Forgetting Common.SideEffects annotations after a custom action changes dependent fields, leaving the UI showing stale data
  • Modifying generated fragment/controller files directly instead of using controller extensions, which breaks on the next code regeneration or app update
  • Mixing key-user adaptation changes with developer extensions in a way that creates layer conflicts and unpredictable precedence at runtime
  • Not testing custom actions with concurrent drafts, causing lock or ETag conflicts in production that were never seen in single-user dev testing

Do this

Best practices

  • Prefer annotation-driven solutions (UI.Applicable, UI.Hidden, Validation, Determination) before reaching for controller extensions
  • Always pair a custom action or determination that changes dependent fields with an explicit Common.SideEffects annotation
  • Keep custom logic in the RAP behavior pool, not scattered in frontend JavaScript, to preserve consistency, authorization checks, and testability
  • Use manifest.json extension points and controller extensions rather than touching generated artifacts directly
  • Document each extension point used and its extensibility category (key user vs developer) for upgrade impact assessments

In the interview

Interview angle

Interviewers probe whether you understand the difference between annotation-only design and flexible programming model extensions, and whether you know when NOT to extend (i.e., prefer declarative solutions). Be ready to explain SideEffects, extension points in manifest.json, and the layered extensibility model (key user vs developer, cloud vs on-premise) as this signals real hands-on RAP+Fiori Elements delivery experience rather than tutorial-level exposure.

Practice this lesson

Quick check

0 of 3 questions attempted

Question 1 of 3

A requirement needs an approval-history section that annotations cannot express. What is the recommended approach?

Practise this in an interview

Answer in your own words and get instant feedback, the way an interviewer would judge it.

1Where should business validations live in a RAP-based Fiori Elements application?

2A requirement cannot be met with annotations alone. How do you extend a Fiori Elements app?

See it in code

Each example starts from a requirement, shows the design, then the code step by step with a plain-language explanation of every part.

Was this lesson helpful?

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.