ERPClimb logoERPClimb
SAPUI5 and SAP Fiori Tools
RAP / CDS / ODataintermediate 9 min read

SAPUI5 and Fiori Tools Part 3: Data Binding — JSON Model, OData Model, Modes

Preview · a free account unlocks the full lesson

Key takeaway

Binding connects UI controls to model data declaratively, using paths such as {/path}, {model /path} or {relativePath}. A JSONModel suits UI state, an OData V4 model suits backend data, and a ResourceModel handles translated texts via i18n. Binding modes include one-way, two-way (the default for V4 inputs), and one-time.

In this lessonShow sections

Visual overview

SAPUI5 and Fiori Tools Part 3: Data Binding — JSON Model, OData Model, Modes — learning sheetIn one line: Understand SAPUI5 data binding with JSONModel and OData models, binding paths, contexts, formatter use and one-way/two-way behavior.ERPClimb.com / RAP / LESSON 3/7 / LEARNING SHEETSAPUI5 and Fiori Tools Part 3: Data Binding — JSON Model,OData Model, Modes1 · IN ONE LINEUnderstand SAPUI5 data binding with JSONModel and OData models, binding paths, contexts,formatter use and one-way/two-way behavior.2 · KEY IDEAS EXPLAINEDWhy Binding Mattersreading a value;finding a control;JsonmodelUse a JSON model for client-side state or smalllocal datasets.Named Modelsdefault OData model;"view" model for UI state;Binding ContextA control can inherit a context.3 · DO · AVOIDBest practice!Common mistakeUse named models for clear concerns.Use contexts.Push large-data operations to backend.✕Huge remote datasets copied into JSONModel.✕Index-based row logic.✕Business rules inside formatter functions.4 · IN A REAL PROJECTA table downloads 50,000 rows into a JSON model and filters them in the browser. Moving filtering/paging tothe OData service dramatically reduces load time and memory.Original ERPClimb learning sheet • Verify against your SAP release and edition

Explanation

Binding connects UI controls to model data declaratively, using paths such as {/path}, {model>/path} or {relativePath}. A JSONModel suits UI state, an OData V4 model suits backend data, and a ResourceModel handles translated texts via i18n. Binding modes include one-way, two-way (the default for V4 inputs), and one-time. Display logic belongs in formatters and expression binding, not in controller code.

Binding matters because, instead of reading a value, finding a control, setting the value, and repeating that cycle after every change, you simply declare the relationship once and let the framework keep it in sync.

A JSON model is used for client-side state or small local datasets. For example, a model might be created with new JSONModel({ customer: { name: "ABC Industries", status: "Active" } }) and set on the view with this.getView().setModel(oModel); the view then references it directly with something like <Text text="{/customer/name}" />.

Named models are used when different kinds of data need to coexist — a default OData model, a "view" model for UI state, and an "i18n" resource model, for instance. A control referencing the named "view" model might look like <ObjectStatus text="{view>/statusText}" />.

Free account

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.