As a SAP infrastructure department, sometimes we encounter a problem within SAP AS (NW / S/4) when a WP is making a write access to DB, therefore a record is being locked until an explicit COMMIT command is made. However, in some cases developers aren't explicitly calling COMMIT (inattentiveness, laziness) thus the record is being locked until an implicit COMMIT is made. That cause other WPs modifying the same record to get stuck for a while (in some cases - until timeout is reached).
We are trying to find a mechanism to recognize such a pattern, at least to monitor the existing situation in production, and preferably to intercept it in the early stages of application development life-cycle.
Static code checks don't seem to be an option:
- There might be justifications to not explicitly
COMMITevery DB write access (I.E: Write access being called inON_COMMITevent. - Queries may reside in functions/methods which called from a process that take care of the commit itself.
We tried to find a relevant monitoring item under RZ20, and didn't find any.
Reproduce:
REPORT zfirst.
DATA: ls_scarr TYPE scarr.
ls_scarr-carrid = 'TST'.
MODIFY scarr FROM ls_scarr.
DO. ENDDO.
REPORT zsecond.
ls_scarr-carrid = 'TST'.
MODIFY scarr FROM ls_scarr.
Run zfirst, it runs forever due to the DO loop. let it stuck. Then Run zsecond. it will stuck in the MODIFY line.