REPORT YEDULOCK.
* This program switches the editor lock flag of a given ABAP program.
* It can be useful when the owner of the ABAP is on holiday ...

TABLES: TRDIR.
PARAMETERS: PRG_NAME LIKE TRDIR-NAME.

SELECT SINGLE * FROM TRDIR WHERE NAME = PRG_NAME.
IF SY-SUBRC = 0.
  IF TRDIR-EDTX = ' '.
    TRDIR-EDTX = 'X'.
  ELSE.
    TRDIR-EDTX = ' '.
  ENDIF.
  MODIFY TRDIR.
  IF SY-SUBRC = 0.
    WRITE: / 'Successful switch.'.
    COMMIT WORK.
  ELSE.
    WRITE: / 'Failed switch.'.
  ENDIF.
ELSE.
  WRITE: / PRG_NAME, ' does not exist.'.
ENDIF.