2014 Jul 09 12:55 PM
HI,
I want to lock program with this fm 'ENQUEUE_ECCATSDBE' but when fm executes program is unlocked. I want to unlock program only when i call function DEQUEUE_E_TABLE
CALL FUNCTION 'ENQUEUE_ECCATSDBE'
EXPORTING
mode_cats_enque = 'E'
mandt = SY-MANDT
pernr = '00100000'
x_pernr = SPACE
_scope = '2'
_wait = SPACE
_collect = ' '
EXCEPTIONS
foreign_lock = 1
system_failure = 2
others = 3
.
IF sy-subrc <> 0 AND sy-subrc >= 1.
ELSE.
ENDIF.
Thanks:)
2014 Jul 09 1:41 PM
Hello,
First of all you have got to unable the lock when creating the program via the transaction SE38.
Then the code below applies or removes the lock as per your needs.
TABLES: TRDIR. "System table
PARAMETERS: P_NAME LIKE TRDIR-NAME,
P_LOCK LIKE TRDIR-EDTX.
SELECT SINGLE * FROM TRDIR WHERE NAME = P_NAME.
TRDIR-EDTX = P_LOCK.
TRDIR-UNAM = TRDIR-CNAM.
TRDIR-UDAT = TRDIR-CDAT.
TRDIR-SDATE = TRDIR-CDAT.
TRDIR-IDATE = TRDIR-CDAT.
MODIFY TRDIR.
IF SY-SUBRC EQ 0.
IF TRDIR-EDTX = 'X'.
WRITE: ' Lock Program:', TRDIR-NAME.
ELSE.
WRITE: ' UnLock Program:', TRDIR-NAME.
ENDIF.
ELSE.
WRITE: / 'Lock/Unlock program failed ', TRDIR-NAME.
ENDIF.
Thanks & Kind Regards,
Yovish.