Skip to main content

Function: callFunctionImport()

callFunctionImport<TData>(page, serviceUrl, functionName, params?, method?, options?): Promise<ODataHttpResult<TData>>

Defined in: src/modules/odata-http.ts:380

Calls an OData function import via HTTP.

Type Parameters​

TData​

TData = unknown

Parameters​

page​

ODataHttpPage

Playwright Page with request API.

serviceUrl​

string

OData service root URL.

functionName​

string

Name of the function import.

params?​

Readonly<Record<string, unknown>>

Parameters for the function import.

method?​

HTTP method ('GET' or 'POST'). Defaults to 'POST'.

"POST" | "GET"

options?​

ODataHttpOptions

HTTP options (CSRF token required for POST).

Returns​

Promise<ODataHttpResult<TData>>

The function import result with HTTP status.

Throws​

ODataError with ERR_ODATA_CSRF if POST and CSRF token missing.

Throws​

ODataError with ERR_ODATA_REQUEST_FAILED on HTTP error.

Example​

const result = await callFunctionImport(page, '/sap/opu/odata/sap/SVC/', 'CalculatePrice', {
ProductID: "'123'",
Quantity: 5,
}, 'GET');