SAP job cancelled on error “The document cannot be blocked”

This post is an example showing how we do trouble-shooting on a SAP SM37 job cancellation on error “The document cannot be blocked”. We used SAP transaction SM37 to find the reason for the job cancellation and we use SAP performance snapshots collected via SAP transaction /SDF/MON and SM12 to confirm the cause – SAP lock operation.

1. The scenario

SAP users complained that SAP job was cancelled without core-dump and asked why.

2 Performance trouble shooting

2.1 Collect information

Talking with SAP users, job name and start date time related to the cancellation is collected and SAP users said that the job is to do a massive change and change document status. Based on those information, the sap job is found and job log is checked. Part of job log is below: Figure 1 – job cancelled on “the document cannot be blocked” From the job log, you can see the error message “the document cannot be blocked” which is a system exception resulting job cancellation.

2.2 What does the error “The document cannot be blocked” mean

Since the job is to do a massive change on document status, it would involve SAP lock � SAP ENQUEUE operation. A document needs to be locked first before it is changed. The lock is released after changes are completed. SAP program has a logic to handle the lock conflict situation. The common logic is to wait and try to lock again up to certain limit � when the limit is exceeded, the program logic would display a specific error on what object cannot be locked and who is occupied that lock. So why is the job hit by error “The document cannot be blocked”. I then checked /SDF/MON log and paid attention to Enqueue lock around the time 05:07 when job cancellation happened. Following is part of /SDF/MON monitor screen: Figure 2 /SDF/MON ENQUEUE entries From figure 2 screen, I found that ENQUEUE entries were closed to Maximum ENQUEUE entries allowed by the SAP system. When the job was cancelled, number of SAP locks dropped from 77,770 to 57. SAP transaction SM12 can be used to check system setting Figure 3 SM12 Enqueue statistics – maximum entries The above SM12 screen (Figure 3) shows that SAP lock was full in the past � this should not happen in a well tuned SAP environment. If you double click on the Maximum Fill Level, it would show Above screens shows number of application locks held by the job � The time in the Table name is mapped to the timing when the job is cancelled and the field “Date” is the start time of the job. Based on the above information, we know what the error “the document cannot be blocked” means � it means the SAP lock is full. The job has held lock on 41,892 objects at the time of cancellation. So this is a design issue. To fix the issue, we can increase the system limit- but apparently this is not a good solution since it is not reasonable for a program to lock 41K business document at one time. Although SAP developer said that their logic is to lock one document, do the change, then release the document, but apparently this is not the case. The program must have a bug. And that bug in the logic must be fixed.

3. Further information

The�SAP lock issue�was fixed by correcting the program logic. The program keeps all documents pending for change in an internal table, loops each entry in that table and change document one by one. The program places a lock at the beginning of loop and release the lock toward the end of loop after changes are completed. But program has many validations executed for a document after the document is locked and before the change as well as unlock operation. If one validation is not passed, the program would bypass all remaining steps and go to next�document in the loop so the lock placed before is not released on such situation. With volume, this occupied all available locks allowed by the SAP system and caused job fallout. So far, you should know how to SAO SM37, SAP /SDF/MON an SAP SM12 to analyze SAP�enqueue full�issue. �You can click my post – how to run /SDF/MON for more information. I have two other posts on how to use /SDF/MON for load analysis and how to use /SDF/MON for memory analysis. If you wonder how to run SAP transaction SM12, understand SM12 screens and how to SAP transaction SM12 for performance analysis, I plan to do post on SM12 in the future.

One thought on “SAP job cancelled on error “The document cannot be blocked””

Leave a Reply