Skip to content

Latest commit

 

History

History
115 lines (93 loc) · 9.54 KB

OData_V4_Model_5de13cf.md

File metadata and controls

115 lines (93 loc) · 9.54 KB
loio
5de13cf4dd1f4a3480f7e2eaaee3f5b8

OData V4 Model

The sap.ui.model.odata.v4.ODataModel is the model implementation for consuming an OData V4 service.

Note:

Instead of smart controls (sap.ui.comp library) or sap.ui.table.AnalyticalTable (or analytical table scenarios) the SAP Fiori elements building blocks (sap.fe.macros) have to be used with the OpenUI5 OData V4 model. The TreeTable is not supported together with the OpenUI5 OData V4 model.

The interface for applications has been changed for an easier and more efficient use of the model. For a summary of these changes, see Changes Compared to OData V2 Model.

The OData V4 model supports the following:

  • Read access

  • Updating properties of OData entities (in entity sets and contained entities) via two-way-binding

  • Deleting entities

  • Operation (function and action) invocation

  • Grouping data requests in a batch request

  • Server-side sorting and filtering

Note:

The OData V4 model documentation contains several code samples. These refer to the Sales Orders sample in the Demo Kit.

  • Model Instantiation and Data Access
    One OData V4 model instance can only cover one OData service. This section describes the creation of a model instance in more detail.
  • Bindings
    Bindings connect OpenUI5 view elements to model data, allowing changes in the model to be reflected in the view element and vice versa.
  • Binding Events
    The OData V4 model supports certain events intended for applications, and others that are to be used for controls, as outlined in this section.
  • Filtering
    The OData V4 Model supports server side filtering on lists.
  • Selection
    The OData V4 Model supports (de-)selection of individual rows and of all rows at once.
  • Sorting
    The OData V4 model supports server side sorting on lists.
  • Value Lists
    The OData V4 model supports the access to value list metadata and data.
  • OData Operations
    The OData V4 model supports OData operations (ActionImport, FunctionImport, bound Actions and bound Functions). Unbound parameters are limited to primitive values.
  • Batch Control
    OData V4 allows you to group multiple operations into a single HTTP request payload, as described in the official OData V4 specification Part 1, Batch Requests (see the link under Related Information for more details).
  • Meta Model for OData V4
    Each OData V4 model offers access via getMetaModel to a corresponding metadata model sap.ui.model.odata.v4.ODataMetaModel, which is read-only and offers access to OData V4 metadata in a streamlined JSON format (see links under Related Information for more details). Only one-time bindings are supported by this model because the metadata is immutable.
  • Performance Aspects
    The OData V4 model offers the features described below which influence performance.
  • Unsupported Superclass Methods and Events
    Certain methods derived from OpenUI5 model and binding superclasses are not supported in OData V4 model classes or have limited support.
  • Changes Compared to OData V2 Model
    This section outlines the main differences between the OData V2 and OData V4 models.
  • Creating an Entity in a Collection
    The sap.ui.model.odata.v4.ODataListBinding#create method creates a new entity inside a collection. Users can interact with a newly created entity even before it has been sent to the server.
  • Creating a Single Entity
    When a single-valued navigation property has a null value, you can create a new entity via a so-called "upsert" (an update that does an insert ). Usually, no API is needed for this as two-way property bindings are sufficient.
  • Draft Handling with the OData V4 Model
    A draft is an interim version of a business entity that has not yet been explicitly saved. Drafts are saved automatically in the background whenever users add or change information within a business entity.
  • Deleting an Entity
    The v4.Context.delete method deletes an entity on the server and updates the user interface accordingly.
  • Consuming OData V2 Services with the OData V4 Model
    The OpenUI5 framework can consume OData V2 Services in a non-intrusive way as if working directly with OData V4.
  • Data Aggregation and Recursive Hierarchy
    The OData V4 Model supports features of the OData Extension for Data Aggregation V4.0 specification.
  • Server Messages in the OData V4 Model
    The OData V4 model supports server messages sent via an OData V4 service.
  • Currency and Unit Customizing in OData V4
    For amounts or measures, you may sometimes need different currencies or units than defined in the CLDR. The data types sap.ui.model.odata.type.Currency and sap.ui.model.odata.type.Unit enable you to use code lists with customizing for currency codes and units.

Related Information

Changes Compared to OData V2 Model

sap.ui.model.odata.v4.ODataModel

Sample: Sales Orders