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

locking

Former Member
0 Likes
501

hi to all,

help me in this issue

when a user is executing a program it should through a error messege to other user who entered the same transaction it must through an error that it is locked.

simoultanously no two users should run the transaction

thanks in advance

kiran kumar.

Message was edited by: kiran kumar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
460

Hi,

lockobject is created using se11

by default enqueue_<lock objectname>

dequeue_<lock objectname> are created

by SAP.

you can create at table level or row level lock.

CALL FUNCTION 'ENQUEUE_EZPPX0010A'

EXPORTING

MODE_ZPPDORD = 'E'

MANDT = SY-MANDT

WERKS = S_WERKS

AUFNR = X_LOCK_LEVEL

EXCEPTIONS

OTHERS = 1.

delete lock after each insertion

or use call function 'DEQUEUE_ALL'

CALL FUNCTION 'DEQUEUE_EZPPX0010A'

EXPORTING

MODE_ZPPDORD = 'E'

MANDT = SY-MANDT

WERKS = S_WERKS

AUFNR = X_LOCK_LEVEL

EXCEPTIONS

OTHERS = 1.

Regards,

amole

3 REPLIES 3
Read only

Former Member
0 Likes
460

Hi

U can create a ZTABLE where you store the program or transaction name and then create a lock object for that table.

In this way in the event INITIALIZATION you raise that lock and if SY-SUBRC <> 0 you raise an error message:

INITIALIZATION.

  CALL FUNCTION 'ENQUEUE_EZFAGTO01'
    EXPORTING
      MODE_ZFAGTO01  = 'E'
      MANDT          = SY-MANDT
      PROGRAMM       = SY-REPID
    EXCEPTIONS
      FOREIGN_LOCK   = 1
      SYSTEM_FAILURE = 2
      OTHERS         = 3.
  IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

Max

Read only

Former Member
0 Likes
460

Hi,

Create a table with only one column say LOCKED ..

Get the column value and check if is ' '..

If so run the program..

If not raise an error message..

If the value is ' '..Then immediately set the value to 'X' and do COMMIT WORK..

Once the program is executed..Then modify the value as ' ' and update the table..

Thanks,

Naren

Read only

Former Member
0 Likes
461

Hi,

lockobject is created using se11

by default enqueue_<lock objectname>

dequeue_<lock objectname> are created

by SAP.

you can create at table level or row level lock.

CALL FUNCTION 'ENQUEUE_EZPPX0010A'

EXPORTING

MODE_ZPPDORD = 'E'

MANDT = SY-MANDT

WERKS = S_WERKS

AUFNR = X_LOCK_LEVEL

EXCEPTIONS

OTHERS = 1.

delete lock after each insertion

or use call function 'DEQUEUE_ALL'

CALL FUNCTION 'DEQUEUE_EZPPX0010A'

EXPORTING

MODE_ZPPDORD = 'E'

MANDT = SY-MANDT

WERKS = S_WERKS

AUFNR = X_LOCK_LEVEL

EXCEPTIONS

OTHERS = 1.

Regards,

amole