Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to lock program

Former Member
0 Likes
761

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:)

1 REPLY 1
Read only

Former Member
0 Likes
515

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.