Skip to content

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:

ts
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, the sap:* attributes) and carries no SAP CAP marker. The v2 output of SAP CAP declares that namespace too; it is told apart by a schema-level Core.Links annotation pointing at cap.cloud.sap, or by references to the public vocabulary addresses.
  • OData v4: a schema namespace starts with com.sap.gateway., or an edmx:Include alias starts with SAP__.

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 ​

Choicesapstandard
Case-insensitive text filter (/x/i)sent case-sensitive; the term is upper-cased for upper-case-only propertiesboth sides wrapped in tolower()
Empty stringcounts as no value: $exists: false is (p eq '' or p eq null)a value like any other
v2 numeric literalsbare (10, 1.5)with their type suffix (10L, 1.5M)
v4 free-text search termsent as typed, so AND, OR, quotes are search syntaxsent as one quoted phrase
v2 function import content typeno Content-Type on a bodyless POSTContent-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=allpages on v2, $count=true on v4.
  • Search: v2 sends the SAP search parameter on a set marked sap:searchable, v4 sends $search unless the set's SearchRestrictions say 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 (DataServiceVersion on v2, OData-Version on v4) and CSRF handling (a HEAD on the service root, under both presets).
  • Messages in the sap-message (v2) and sap-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:

ts
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 ​

ServiceODataPresetNotes
SAP Gateway (SEGW)v2sapValue lists in the $metadata or in separate annotation documents (the latter not read)
SAP RAPv4sapValue lists in value-help services (Common.ValueListReferences), aggregation via $apply
SAP CAPv4, v2standardcuid keys become @db.default.uuid; v2 through SAP CAP's adapter
Any other OData servicev2, v4standardNorthwind, TripPin and the like

Facts that come up with SAP services:

  • sap-client goes in the query option, so every call carries it, the CSRF fetch and $metadata included: query: { "sap-client": "100" }.
  • sap-language of the metadata reads comes from the models' language (see Live Metadata), over one in query. A sap-language in query fixes 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. $top and $skip are 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 answers 400 with its message.
  • Counts in $apply are not offered: SAP services answer them with 501 (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 ​

SAP, SAP S/4HANA, SAP Fiori, SAPUI5, SAP BTP and other SAP products and services mentioned herein, as well as their respective logos, are trademarks or registered trademarks of SAP SE (or an SAP affiliate company) in Germany and other countries. Atscript OData is an independent open-source project and is not affiliated with, sponsored or endorsed by SAP SE.
Released under the MIT License.