1

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:

  1. There might be justifications to not explicitly COMMIT every DB write access (I.E: Write access being called in ON_COMMIT event.
  2. 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.

1 Answer 1

2

I think you can detect basic infinitive loops with code analyzer. But these loops already founded and fixed in test step.

DB locks is a completely design problem. Architect needs to plan the solution for thinking about parallel updates (if needed).

You can get list of locks under DB01 t-code Locks section.

I want to add some notes here:

  • Developer can use locking mechanism for table lines.
  • Developer can call commit work manually if there is not need to rollback.
Sign up to request clarification or add additional context in comments.

1 Comment

Small addition: DB01 > Diagnostics > Locks > Blocked Transactions also shows that "zsecond" is blocked by "zfirst" for the example the OP provided.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.