how to lock and unlock ABAP program

This tutorial will teach you how to lock and unlock ABAP program by updating the table TRDIR, once the program is locked, then only the program’s author has the authority to edit it.
Report Z_Lock_Unlock_ABAP_Program.
“A Sample Code To Lock And Unlock ABAP Program Editor
* Table Declaration
TABLES: TRDIR.
*Declare the parameters
Parameter: P_PRGNAME LIKE TRDIR-NAME,
P_PRGEDTR LIKE TRDIR-EDTX.
* Query the specified program name from
* table TRDIR

SELECT SINGLE * FROM TRDIR WHERE NAME = P_PROG.
* Set/Remove the lock
TRDIR-EDTX = P_PRGEDTR.
MODIFY TRDIR.
IF SY-SUBRC EQ 0.
WRITE: / ‘Program Editor is locked successfully’, TRDIR-NAME.
IF TRDIR-EDTX = ‘X’.
WRITE: ‘ Lock’.
ELSE.
WRITE: ‘ UnLock’.
ENDIF.
ELSE.
WRITE: / ‘Program Editor Lock update Unsuccessful ‘, TRDIR-NAME.
ENDIF.

Subscribe in a reader

Comments

0 Responses to "how to lock and unlock ABAP program"

Post a Comment

Stay Updated