Dialects and Vendors
Services of the same OData version still differ in how they want some requests written. A dialect is a preset of those choices. There are two, sap and standard, and the core picks one from the $metadata by itself. Name one only when the guess is wrong:
createODataClientFactory({
services: [{ baseUrl, model, types: sales, dialect: "standard" }],
});
// on a Moost server: createODataSpace({ baseUrl, model, types: sales, dialect: "standard", init })How a service is recognized
The parser marks a document that SAP Gateway® or RAP produced as an SAP document; the engine then defaults to sap, and to standard for everything else.
- OData v2: the document declares the SAP data namespace (
http://www.sap.com/Protocols/SAPData, thesap:*attributes) and carries no SAP CAP marker. The v2 output of SAP CAP declares that namespace too; it is told apart by a schema-levelCore.Linksannotation pointing atcap.cloud.sap, or by references to the public vocabulary addresses. - OData v4: a schema namespace starts with
com.sap.gateway., or anedmx:Includealias starts withSAP__.
So SAP Gateway and RAP services get sap; SAP CAP services (v4, and v2 through its adapter), and any other service, get standard.
What a preset decides
| Choice | sap | standard |
|---|---|---|
Case-insensitive text filter (/x/i) | sent case-sensitive; the term is upper-cased for upper-case-only properties | both sides wrapped in tolower() |
| Empty string | counts as no value: $exists: false is (p eq '' or p eq null) | a value like any other |
| v2 numeric literals | bare (10, 1.5) | with their type suffix (10L, 1.5M) |
| v4 free-text search term | sent as typed, so AND, OR, quotes are search syntax | sent as one quoted phrase |
| v2 function import content type | no Content-Type on a bodyless POST | Content-Type: application/json |
The last one matters only for operations. There are no partial overrides: a service uses one preset as a whole. The switches are listed in the API reference.
Text filters on SAP services
Under sap, a case-insensitive pattern such as a table's "contains" filter is sent case-sensitive, with the term upper-cased where the property is declared upper-case only (sap:display-format="UpperCase", Common.IsUpperCase). Under standard it is wrapped in tolower(), which the service has to accept. If a non-SAP service refuses tolower, name sap; if an SAP service accepts it and you want case-insensitive matching, name standard.
Patterns are limited to what OData functions can express on both: ^literal, literal$ and literal (startswith, endswith, substringof on v2, contains on v4). Any other regular expression is refused.
What does not depend on the dialect
These follow the OData version of the document, whatever the preset:
- Literals: v2 writes
guid'…',datetime'…',datetimeoffset'…'; v4 writes them bare. - Counts:
$inlinecount=allpageson v2,$count=trueon v4. - Search: v2 sends the SAP
searchparameter on a set markedsap:searchable, v4 sends$searchunless the set'sSearchRestrictionssay it cannot (see Search on v4 services). - Decimals and 64-bit integers on v4 are asked for as strings (
IEEE754Compatible=true), so they keep their full precision. - Version headers (
DataServiceVersionon v2,OData-Versionon v4) and CSRF handling (aHEADon the service root, under both presets). - Messages in the
sap-message(v2) andsap-messages(v4) response headers are read for every service. - Operations: a v2 function import is called at the service root, also one that acts on an entity (
sap:action-for): the key travels as parameters. A v4 bound operation is called behind its entity or entity set.
Search on v4 services
OData v4 takes an entity set as searchable unless its Capabilities.SearchRestrictions say otherwise, and SAP CAP serves $search without declaring it, so a v4 set is searchable by default: /meta says searchable: true and Atscript UI shows a search box. Some v4 services refuse $search all the same and declare nothing (Northwind and other services built on WCF Data Services or ASP.NET Web API answer 400). For such a service set search: false in the space's options or the browser registration:
createODataSpace({ baseUrl, model, types: northwind, search: false });
createODataClientFactory({ services: [{ baseUrl, model, types: northwind, search: false }] });A set is then searchable only where the metadata declares it: a SearchRestrictions record whose Searchable is not false (it defaults to true), v2 sap:searchable="true" (so a v2 service is unchanged). The others answer searchable: false in /meta, and a search is refused before any request. It is a runtime option: the generated files stay as they are.
Vendors
| Service | OData | Preset | Notes |
|---|---|---|---|
| SAP Gateway (SEGW) | v2 | sap | Value lists in the $metadata or in separate annotation documents (the latter not read) |
| SAP RAP | v4 | sap | Value lists in value-help services (Common.ValueListReferences), aggregation via $apply |
| SAP CAP | v4, v2 | standard | cuid keys become @db.default.uuid; v2 through SAP CAP's adapter |
| Any other OData service | v2, v4 | standard | Northwind, TripPin and the like |
Facts that come up with SAP services:
sap-clientgoes in thequeryoption, so every call carries it, the CSRF fetch and$metadataincluded:query: { "sap-client": "100" }.sap-languageof the metadata reads comes from the models'language(see Live Metadata), over one inquery. Asap-languageinqueryfixes the language of every data call too.- Sessions: the CSRF token is bound to the session cookie, so a server needs a session for writes; the space of a Moost server keeps one per credential (see Writes and Concurrency).
- Paging:
sap:pageable="false"is advisory.$topand$skipare sent anyway; a service that ignores them on the first page is detected, and the page is cut to its size. - Mandatory filters (
sap:requires-filter,RequiresFilter) are advisory: reads are sent without them, and a service that insists answers400with its message. - Counts in
$applyare not offered: SAP services answer them with501(see Aggregation). - Optimistic concurrency declared without properties gives no version token on an SAP service, whose entities carry no ETag then.
- Drafts: draft-enabled sets are read for their active entities and take no write (see Limitations).
See also
dialectFor,defaultDialectName,resolveDialectin the API reference.- Limitations: what no preset changes.