SAP TR_CHECK_OBJECT_LOCK Function Module for Check Long-Running Locks for (Sub-)Object (E071)
TR_CHECK_OBJECT_LOCK is a standard tr check object lock SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Check Long-Running Locks for (Sub-)Object (E071) processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.
See here to view full function module documentation and code listing for tr check object lock FM, simply by entering the name TR_CHECK_OBJECT_LOCK into the relevant SAP transaction such as SE37 or SE38.
Function Group: STRI
Program Name: SAPLSTRI
Main Program: SAPLSTRI
Appliation area: S
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function TR_CHECK_OBJECT_LOCK pattern details
In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.CALL FUNCTION 'TR_CHECK_OBJECT_LOCK'"Check Long-Running Locks for (Sub-)Object (E071).
EXPORTING
WI_PGMID = "Program ID in requests and tasks
WI_OBJECT = "Object Type
WI_OBJNAME = "Object name in object list
* IT_TLOCK_ENTRIES = "When filled, this table is evaluated instead of the database table
IMPORTING
WE_LOCKABLE_OBJECT = "'X' = Object type lockable; ' ' = Object type not lockable
WE_LOCKED = "'X' = Object locked; ' ' = Object unlocked
WE_LOCK_ORDER = "Current lock request number (transport request/correction request)
WE_LOCK_ORDER_USER = "User name of request for lock request
WE_LOCK_TASK = "Request number (transport request) for lock request number
WE_LOCK_TASK_USER = "User name of current lock request
WE_OBJECT_EDITABLE = "'X' = Object editable by user; ' ' = Not editable
WE_POSSIBLE_USER_EDIT_TASK = "Editable with this task number (correction number)
TABLES
* WT_TLOCK = "All locks within range
EXCEPTIONS
EMPTY_KEY = 1 NO_SYSTEMNAME = 2 NO_SYSTEMTYPE = 3 UNALLOWED_LOCK_ORDER = 4
IMPORTING Parameters details for TR_CHECK_OBJECT_LOCK
WI_PGMID - Program ID in requests and tasks
Data type: E071-PGMIDOptional: No
Call by Reference: No ( called with pass by value option)
WI_OBJECT - Object Type
Data type: E071-OBJECTOptional: No
Call by Reference: No ( called with pass by value option)
WI_OBJNAME - Object name in object list
Data type: E071-OBJ_NAMEOptional: No
Call by Reference: No ( called with pass by value option)
IT_TLOCK_ENTRIES - When filled, this table is evaluated instead of the database table
Data type: TRTLOCKSOptional: Yes
Call by Reference: Yes
EXPORTING Parameters details for TR_CHECK_OBJECT_LOCK
WE_LOCKABLE_OBJECT - 'X' = Object type lockable; ' ' = Object type not lockable
Data type: TRPARI-S_CHECKEDOptional: No
Call by Reference: No ( called with pass by value option)
WE_LOCKED - 'X' = Object locked; ' ' = Object unlocked
Data type: TRPARI-S_CHECKEDOptional: No
Call by Reference: No ( called with pass by value option)
WE_LOCK_ORDER - Current lock request number (transport request/correction request)
Data type: E070-TRKORROptional: No
Call by Reference: No ( called with pass by value option)
WE_LOCK_ORDER_USER - User name of request for lock request
Data type: E070-AS4USEROptional: No
Call by Reference: No ( called with pass by value option)
WE_LOCK_TASK - Request number (transport request) for lock request number
Data type: E070-TRKORROptional: No
Call by Reference: No ( called with pass by value option)
WE_LOCK_TASK_USER - User name of current lock request
Data type: E070-AS4USEROptional: No
Call by Reference: No ( called with pass by value option)
WE_OBJECT_EDITABLE - 'X' = Object editable by user; ' ' = Not editable
Data type: TRPARI-S_CHECKEDOptional: No
Call by Reference: No ( called with pass by value option)
WE_POSSIBLE_USER_EDIT_TASK - Editable with this task number (correction number)
Data type: E070-TRKORROptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for TR_CHECK_OBJECT_LOCK
WT_TLOCK - All locks within range
Data type: TLOCKOptional: Yes
Call by Reference: Yes
EXCEPTIONS details
EMPTY_KEY - Select fields in LOCK_KEY are empty (system error)
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NO_SYSTEMNAME - System name cannot be determined or invalid length
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NO_SYSTEMTYPE - System type cannot be determined
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
UNALLOWED_LOCK_ORDER - Request in lock is empty or does not exist
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for TR_CHECK_OBJECT_LOCK Function Module
The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.| DATA: | ||||
| lv_wi_pgmid | TYPE E071-PGMID, " | |||
| lt_wt_tlock | TYPE STANDARD TABLE OF TLOCK, " | |||
| lv_empty_key | TYPE TLOCK, " | |||
| lv_we_lockable_object | TYPE TRPARI-S_CHECKED, " | |||
| lv_we_locked | TYPE TRPARI-S_CHECKED, " | |||
| lv_wi_object | TYPE E071-OBJECT, " | |||
| lv_no_systemname | TYPE E071, " | |||
| lv_wi_objname | TYPE E071-OBJ_NAME, " | |||
| lv_no_systemtype | TYPE E071, " | |||
| lv_we_lock_order | TYPE E070-TRKORR, " | |||
| lv_it_tlock_entries | TYPE TRTLOCKS, " | |||
| lv_we_lock_order_user | TYPE E070-AS4USER, " | |||
| lv_unallowed_lock_order | TYPE E070, " | |||
| lv_we_lock_task | TYPE E070-TRKORR, " | |||
| lv_we_lock_task_user | TYPE E070-AS4USER, " | |||
| lv_we_object_editable | TYPE TRPARI-S_CHECKED, " | |||
| lv_we_possible_user_edit_task | TYPE E070-TRKORR. " |
|   CALL FUNCTION 'TR_CHECK_OBJECT_LOCK' "Check Long-Running Locks for (Sub-)Object (E071) |
| EXPORTING | ||
| WI_PGMID | = lv_wi_pgmid | |
| WI_OBJECT | = lv_wi_object | |
| WI_OBJNAME | = lv_wi_objname | |
| IT_TLOCK_ENTRIES | = lv_it_tlock_entries | |
| IMPORTING | ||
| WE_LOCKABLE_OBJECT | = lv_we_lockable_object | |
| WE_LOCKED | = lv_we_locked | |
| WE_LOCK_ORDER | = lv_we_lock_order | |
| WE_LOCK_ORDER_USER | = lv_we_lock_order_user | |
| WE_LOCK_TASK | = lv_we_lock_task | |
| WE_LOCK_TASK_USER | = lv_we_lock_task_user | |
| WE_OBJECT_EDITABLE | = lv_we_object_editable | |
| WE_POSSIBLE_USER_EDIT_TASK | = lv_we_possible_user_edit_task | |
| TABLES | ||
| WT_TLOCK | = lt_wt_tlock | |
| EXCEPTIONS | ||
| EMPTY_KEY = 1 | ||
| NO_SYSTEMNAME = 2 | ||
| NO_SYSTEMTYPE = 3 | ||
| UNALLOWED_LOCK_ORDER = 4 | ||
| . " TR_CHECK_OBJECT_LOCK | ||
ABAP code using 7.40 inline data declarations to call FM TR_CHECK_OBJECT_LOCK
The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.| "SELECT single PGMID FROM E071 INTO @DATA(ld_wi_pgmid). | ||||
| "SELECT single S_CHECKED FROM TRPARI INTO @DATA(ld_we_lockable_object). | ||||
| "SELECT single S_CHECKED FROM TRPARI INTO @DATA(ld_we_locked). | ||||
| "SELECT single OBJECT FROM E071 INTO @DATA(ld_wi_object). | ||||
| "SELECT single OBJ_NAME FROM E071 INTO @DATA(ld_wi_objname). | ||||
| "SELECT single TRKORR FROM E070 INTO @DATA(ld_we_lock_order). | ||||
| "SELECT single AS4USER FROM E070 INTO @DATA(ld_we_lock_order_user). | ||||
| "SELECT single TRKORR FROM E070 INTO @DATA(ld_we_lock_task). | ||||
| "SELECT single AS4USER FROM E070 INTO @DATA(ld_we_lock_task_user). | ||||
| "SELECT single S_CHECKED FROM TRPARI INTO @DATA(ld_we_object_editable). | ||||
| "SELECT single TRKORR FROM E070 INTO @DATA(ld_we_possible_user_edit_task). | ||||
Search for further information about these or an SAP related objects