Wednesday, February 18, 2015

How to find out SM12 entries...?

Transaction SM12 is very useful also in BW. The SM12 is about the locks. By the locks in SAP system data integrity is guarded.  In case one user is changed an business objects an attempt to change the same objects is rejected by the system because the lock was already set for object for the first user. So basically only one process or one user is allowed to change the business object at same time. This functionality in SAP is called SAP lock/enqueue handling.

Speaking of BW just remember in case of planning application how many time we have to remove lock entries to enable user save the data while particular row was locked by other user some time ago and it wasn’t removed.

Well but what to do in case an access to t-code SM12 is not granted for some reason and simply user is not authorized to run the t-code. Actually there is no table which stored these locks. The locks are managed on operating system level. What the system does while we run the SM21 is that FM ENQUE_READ2 is running. The FM executes following ABAP statement:

                   ID 'OPCODE2'   FIELD OPCODE2
                   ID 'ENQTABLE'  FIELD ENQ-*SYS*
                   ID 'GRANULE'   FIELD GRANULE
                   ID 'ARG'       FIELD GARG
                   ID 'UNAME'     FIELD GUNAME
                   ID 'CLIENT'    FIELD GCLIENT.

This means a command on operating system level, so called C-function (as ABAP interpreter is written in C/C++). Name of C function in this case is 'C_ENQUEUE'. Conclusion is that w/o access to the t-code SM12 it is not possible to find out what are current locks set in the SAP system.

No comments: