Skip to main content
Version: 1.x

Function: updateEntity()

updateEntity<TData>(page, serviceUrl, entitySet, key, data, options?): Promise<ODataHttpResult<TData>>

Ai

Updates an existing entity via HTTP PATCH.

Type Parameters

TData

TData = unknown

Parameters

page

ODataHttpPage

Playwright Page with request API.

serviceUrl

string

OData service root URL.

entitySet

string

Name of the entity set.

key

string

Entity key including parentheses, e.g. "('123')".

data

unknown

Partial entity data to update.

options?

ODataHttpOptions

HTTP options including required CSRF token.

Returns

Promise<ODataHttpResult<TData>>

The updated entity with HTTP status and optional ETag.

Capability

ui5.odata.updateEntity

Intent

Update an existing OData entity by sending a PATCH request with partial data.

Guarantee

On success, the entity is updated and the response contains the updated entity data.

Ai Context

Uses Playwright's request API to PATCH the entity. Only changed fields need to be provided. Requires a CSRF token. ETag is returned for optimistic concurrency control.

Sap Module

sap.ui.model.odata.v2.ODataModel — HTTP-level entity update

Business Context

Update existing business entities (e.g., change PO quantity, update product price).

Throws

ODataError with ERR_ODATA_CSRF if CSRF token is missing.

Throws

ODataError with ERR_ODATA_REQUEST_FAILED on HTTP error.

Example

const result = await updateEntity(page, '/sap/opu/odata/sap/SVC/', 'Products', "('123')", {
Price: 50,
}, { csrfToken: token });