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

Lock objects

Former Member
0 Likes
910

Hi

I have a requirement where I have to give message in the program that if the project number(PROJ-PSPID) entered on the selection screen is opened by another user in CJ02(Change project ) the i should give message 'Project 'X' is blocked by the user'. How to do this?

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
796

Call FM CJDW_ENQUEUE to check if the project is locked.

Values to be passed:

OBJECT_ID = PROJ-PSPID

OTYPE = H

If this FM returns sy-subrc = 1 then the project is locked in some other session

4 REPLIES 4
Read only

Former Member
0 Likes
796

Hi,

Approach USER EXIT for this.

Read only

Former Member
0 Likes
797

Call FM CJDW_ENQUEUE to check if the project is locked.

Values to be passed:

OBJECT_ID = PROJ-PSPID

OTYPE = H

If this FM returns sy-subrc = 1 then the project is locked in some other session

Read only

Former Member
0 Likes
796

Create a lock object in se11.

eg: E_LockObj.

Call function Enqueue_E_LockObj.

pass ur Field value which has to be locked here.

Call Funcition Dequeue_E_LockObj.

Unlock the field value here(ie when ever u press exit/back button this FM can be called).

Reward if useful

Read only

Former Member
0 Likes
796

Hi,

GO TO SE11

SELECT LOCK OBJECT NAME IT AS

'EZXXXXXXXX' - FIRST LETTER SHOULD BE 'E' AND SECOND MUST BE 'Z' OR 'Y' 

REST IS AS U FEEL.

GIVE TABLE NAME U WANT 2 LOCK AND SELECT : EXCLUSIVE,CUMULATIVE AND ACTIVATE


FUNCTION MODULE WILL BE GENERATED WITH NAME

*ENQUEUE_EZXXXXXXX*

*DEQUEUE_EZXXXXXXX*

USE THE BELOW CODE IN UR PROGRAM

call function 'ENQUEUE_EZMIGO_LOCK'
   exporting
*   MODE_ZG1_MKPF        = 'E'
     mandt                = sy-mandt
     g1sno                = pg1sno
*   X_G1SNO              = ' '
*   _SCOPE               = '2'
*   _WAIT                = ' '
*   _COLLECT             = ' '
   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.

Regards,

V.Balaji

Reward if Usefull...