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

re: lock objects

Former Member
0 Likes
1,360

Hi,

Iam implementing some screens. I created some lock objects. I could not able to under these concepts. Even though I studied some documents, i could not get the below concepts. can anybody explain.

1. what is the enqueue mode

2. what is the scope

3.what is the wait parametrs

rgds

p.kp

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,279

Hi paluri,

Info taken from standard sap help.

1. Enqueu Mode.

The lock mode controls whether several users can access data records at the same time. The lock mode can be assigned separately for each table in the lock object. When the lock is set, the corresponding lock entry is stored in the lock table of the system for each table.

Access by more than one user can be synchronized in the following ways:

Exclusive lock: The locked data can only be displayed or edited by a single user. A request for another exclusive lock or for a shared lock is rejected.

Shared lock: More than one user can access the locked data at the same time in display mode. A request for another shared lock is accepted, even if it comes from another user. An exclusive lock is rejected.

Exclusive but not cumulative: Exclusive locks can be requested several times from the same transaction and are processed successively. In contrast, exclusive but not cumulative locks can be called only once from the same transaction. All other lock requests are rejected.

2. Scope

Parameter _SCOPE controls how the lock or lock release is passed to the update program (see The Owner Concept for Locks). You have the following options:

_SCOPE = 1: Locks and lock releases are not passed to the update program. The lock is removed when the transaction is ended.

_SCOPE = 2: The lock or lock release is passed to the update program. The update program is responsible for removing the lock. The interactive program with which the lock was requested no longer has an influence on the lock behavior. This is the standard setting for the ENQUEUE function module.

_SCOPE = 3: The lock or lock release is also passed to the update program. The lock must be removed in both the interactive program and in the update program. This is the standard setting for the DEQUEUE function module.

3. WAIT

The ENQUEUE function module also has the parameter _WAIT. This parameter determines the lock behavior when there is a lock conflict.

You have the following options:

Initial value: If a lock attempt fails because there is a competing lock, the exception FOREIGN_LOCK is triggered.

X : If a lock attempt fails because there is a competing lock, the lock attempt is repeated after waiting for a certain time. The exception FOREIGN_LOCK is triggered only if a certain time limit has elapsed since the first lock attempt. The waiting time and the time limit are defined by profile parameters.

regards,

amit m.

10 REPLIES 10
Read only

Former Member
0 Likes
1,279

Scope- Indicates who owns the lock

Read only

0 Likes
1,279

check this thread...

Read only

0 Likes
1,279

Hi won,

u given answer that scope is for own lock. What does it mean.

rgds

p.kp

Read only

0 Likes
1,279
Read only

0 Likes
1,279

Hi,

just look at my requirement. I created dynpro screens.In the first screen i have to enter the employee no and after choosing edit button i have to go to one more screen. If any body enters the same screen with the same employee number it has to restrict automatically.

so i have used lock object for this employee no. But i want to allow the users in read mode. for this i used

like this

call function 'ENQUEUE_EZ_ENO'

exporting

mode_zemptr = 'S'

eno = eno.

But if i open this transaction in one more session, it allowing the users to edit. what is the problem.

second one is what is the use of scope parameter. can anybody explain in real time scenario.

rgds

p.kp

Read only

0 Likes
1,279

Hi paluri,

I have used this and it works fantastic

in multi-user, multi-session environment

1. For your requirement of Employee,

use the FM.

HR_EMPLOYEE_ENQUEUE

HR_EMPLOYEE_DEQUEUE

2.

DATA : ret LIKE bapireturn1.

DATA : locking_user LIKE sy-uname.

*----


For Enque

IF react = 'E'.

CALL FUNCTION 'HR_EMPLOYEE_ENQUEUE'

EXPORTING

number = ptab-pernr

IMPORTING

return = ret

locking_user = locking_user.

3. In case of VIEW,

do not enque.

In case of edit, Yes, enqueue.

4. This FM is standard SAP.

Hence, it will take care of other sap

trnascations like pa30 etc.

regards,

amit m.

Message was edited by: Amit Mittal

Read only

0 Likes
1,279

Hi amit,

Because of some reasons iam using other type of data elemtn to emp name. i want to know what is the exact use of enqueue mode shared type and scope in real time. what is the use of argumetn value.

rgds

p.kp

Read only

Former Member
0 Likes
1,279

Hi,

<b>for wait parameter</b>

wAIT UP TO time SECONDS

Effect

The program execution is interrupted for time seconds. After this period, the program processing resumes.

WAIT UNTIL logexp.

... UP TO time SECONDS.

Effect

Before executing the WAIT statement, the condition in the logical expression logexp is evaluated. If this is satisfied, the execution of the program continues after WAIT. Otherwise, the results of the previously called asynchronous Remote Function Call are accepted until one of the FORM routines (RECEIVE RESULTS FROM FUNCTION func) that performs the task in question satisfies this condition or until there are no more asynchronous calls. In both cases, the program processing continues after WAIT.

<b>for Enqueue</b>

is used to lock the objects.

<b>for scope</b>

scope of variable will give whether the variable is local or global.

Regards,

Sunil

Read only

Former Member
0 Likes
1,280

Hi paluri,

Info taken from standard sap help.

1. Enqueu Mode.

The lock mode controls whether several users can access data records at the same time. The lock mode can be assigned separately for each table in the lock object. When the lock is set, the corresponding lock entry is stored in the lock table of the system for each table.

Access by more than one user can be synchronized in the following ways:

Exclusive lock: The locked data can only be displayed or edited by a single user. A request for another exclusive lock or for a shared lock is rejected.

Shared lock: More than one user can access the locked data at the same time in display mode. A request for another shared lock is accepted, even if it comes from another user. An exclusive lock is rejected.

Exclusive but not cumulative: Exclusive locks can be requested several times from the same transaction and are processed successively. In contrast, exclusive but not cumulative locks can be called only once from the same transaction. All other lock requests are rejected.

2. Scope

Parameter _SCOPE controls how the lock or lock release is passed to the update program (see The Owner Concept for Locks). You have the following options:

_SCOPE = 1: Locks and lock releases are not passed to the update program. The lock is removed when the transaction is ended.

_SCOPE = 2: The lock or lock release is passed to the update program. The update program is responsible for removing the lock. The interactive program with which the lock was requested no longer has an influence on the lock behavior. This is the standard setting for the ENQUEUE function module.

_SCOPE = 3: The lock or lock release is also passed to the update program. The lock must be removed in both the interactive program and in the update program. This is the standard setting for the DEQUEUE function module.

3. WAIT

The ENQUEUE function module also has the parameter _WAIT. This parameter determines the lock behavior when there is a lock conflict.

You have the following options:

Initial value: If a lock attempt fails because there is a competing lock, the exception FOREIGN_LOCK is triggered.

X : If a lock attempt fails because there is a competing lock, the lock attempt is repeated after waiting for a certain time. The exception FOREIGN_LOCK is triggered only if a certain time limit has elapsed since the first lock attempt. The waiting time and the time limit are defined by profile parameters.

regards,

amit m.

Read only

Former Member
0 Likes
1,279

Go to se11 and select the lockobject radio button then create ur own lock object. if you need more info let me know