Skip to main content
Version: 1.x

Function: sapObjectLock()

sapObjectLock(objectType, objectKey): string

Builds a lock name scoped to one SAP business object.

Parameters​

objectType​

string

Business object type, e.g. 'PurchaseOrder'.

objectKey​

string

The instance key, e.g. '4500000123'.

Returns​

string

A lock name of the form sap:sm12:<objectType>:<objectKey>.

Remarks​

Named after SM12, the SAP lock-entry transaction, because this is the client-side counterpart: it stops two workers reaching the same object at once, rather than reporting the collision after the fact.

Scoped deliberately — two tests editing different purchase orders should still run in parallel, which a single blanket sap:purchase-order lock would prevent.

Throws​

PramanError with ERR_CONFIG_INVALID when either part is blank.

Example​

import { sapObjectLock } from 'playwright-praman';

const lock = sapObjectLock('PurchaseOrder', '4500000123');
// 'sap:sm12:PurchaseOrder:4500000123'

test('approves the PO', { lock }, async ({ ui5 }) => { ... });