Help in lock object
HI All
i am want to handle lock object for instance if i want to lock some object and it's already locked i want to do some loop on it for 5 times .
1. i need to know if what i was doing is OK since this is my first time .
2. what should i use i parameter wait can it help me ?
Kind Regards
Chris
iv_try_x_times = 5. "this value on the method signature
DO iv_try_x_times TIMES.
lv_count = lv_count + 1.
CALL FUNCTION ENQUEUE_USR_DATA
EXPORTING
mandt = sy-mandt
userid = mv_userid
x_for_user = iv_is_exact
_wait = iv_is_wait
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
IF sy-subrc = 0.
RETURN.
ENDIF.
IF lv_count < iv_try_x_times.
WAIT UP TO 1 SECONDS.
ENDIF.
ENDDO
Hi Chris,
Such a code piece might help you;
data: is_locked type c,
lv_counter type i.
is_locked = ''.
lv_counter = 0.
while is_locked = '' and lv_counter < 5.
lv_counter = lv_counter + 1.
CALL FUNCTION ENQUEUE_USR_DATA
EXPORTING
mandt = sy-mandt
userid = mv_userid
x_for_user = iv_is_exact
_wait = iv_is_wait
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
IF sy-subrc = 0.
is_locked = 'X'.
else.
wait up to 1 seconds.
endif.
endwhile.
Regards;
Ozcan.
Similar Messages
-
Hi All,
I have doubt about lock object,
when we create lock object ENQUEUE_OBJ AND DEQUEUE_OBJ also gets created but what about transporting it? should we transport it saparately or automatically its get transported?
Thx.Check the below link
[http://help.sap.com/saphelp_nw70/helpdata/en/cf/21eef3446011d189700000e8322d00/content.htm|http://help.sap.com/saphelp_nw70/helpdata/en/cf/21eef3446011d189700000e8322d00/content.htm]
When you save a lock object, it will ask for a trasport request to be saved under. Once that is given, the generated FMs ENQUEUE_<lockobjectname> and DEQUEUE_<lockobjectname> are also saved under the same transport request.
1. Check your QA system whether the 2 generated FMs for the <lockobjectname> exist in QA?
2. Also check in SE11 whether <lockobjectname> exist in QA?
Hope it helps.
Thanks,
Balaji -
Hello All ,
I have create one Module Pool program.it is having three t code for creation ,change and display. it is having two table Header and details table.
I have decided to go for shared lock as per requirement. That's why created on lock object with the help of t code se11 .
My problem is how do I call that lock object in program, because all the lock object are called using called function PATTERN. When I am also trying to do the same it give me message function not found.
Can some one tell me :
1 . How do I called lock object in my program.
2. Lock object : lock parameter are there ,Means the primery key of lock object on the logic of this the lock object is called.
3. would the same lock I can called for Create and change also. Would i work ?. At the same time other operation can perform.
Please provide me the ansower of the question.
regards
Swati namdeoHi
Hope it will help you.
Pls reward if help.
Lock objects are use in SAP to avoid the inconsistancy at the time of data is being insert/change into database.
SAP Provide three type of Lock objects.
- Read Lock(Shared Locked)
protects read access to an object. The read lock allows other transactions read access but not write access to
the locked area of the table
- Write Lock(exclusive lock)
protects write access to an object. The write lock allows other transactions neither read nor write access to
the locked area of the table.
- Enhanced write lock (exclusive lock without cumulating)
works like a write lock except that the enhanced write lock also protects from further accesses from the
same transaction.
You can create a lock on a object of SAP thorugh transaction SE11 and enter any meaningful name start with EZ Example EZTEST_LOCK.
Use: you can see in almost all transaction when you are open an object in Change mode SAP could not allow to any other user to open the same object in change mode.
Example: in HR when we are enter a personal number in master data maintainance screen SAP can't allow to any other user to use same personal number for changes.
Technicaly:
When you create a lock object System automatically creat two function module.
1. ENQUEUE_<Lockobject name>. to insert the object in a queue.
2. DEQUEUE_<Lockobject name>. To remove the object is being queued through above FM.
You have to use these function module in your program.
check this link for example.
http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
tables:vbak.
call function 'ENQUEUE_EZLOCK3'
exporting
mode_vbak = 'E'
mandt = sy-mandt
vbeln = vbak-vbeln
X_VBELN = ' '
_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.
Normally ABAPers will create the Lock objects, because we know when to lock and how to lock and where to lock the Object then after completing our updations we unlock the Objects in the Tables
http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
purpose: If multiple user try to access a database object, inconsistency may occer. To avoid that inconsistency and to let multiple user give the accessibility of the database objects the locking mechanism is used.
Steps: first we create a loc object in se11 . Suppose for a table mara. It will create two functional module.:
1. enque_lockobject
1. deque_lockobject
before updating any table first we lock the table by calling enque_lockobject fm and then after updating we release the lock by deque_lockobject.
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
GO TO SE11
Select the radio button "Lock object"..
Give the name starts with EZ or EY..
Example: EYTEST
Press Create button..
Give the short description..
Example: Lock object for table ZTABLE..
In the tables tab..Give the table name..
Example: ZTABLE
Save and generate..
Your lock object is now created..You can see the LOCK MODULES..
In the menu ..GOTO -> LOCK MODULES..There you can see the ENQUEUE and DEQUEUE function
Lock objects:
http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm
http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
Match Code Objects:
http://help.sap.com/saphelp_nw2004s/helpdata/en/41/f6b237fec48c67e10000009b38f8cf/content.htm
http://searchsap.techtarget.com/tip/0,289483,sid21_gci553386,00.html
See this link:
http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm
Check these links -
lock objects
Lock Objects
Lock Objects -
Lock object is not working automatically
Hi experts,
i have a problem , A table is updated by a program which is used by multiple user . I have used lock function module 'ENQUEUE_E_TABLE ' and 'DEQUEUE_E_TABLE' for that . when updation section occurs first user which come first go through it and for rest users amessage cones 'table is locked by XYZ user' . When first completes the updation resr users is not updating automatically they stand at that position where message comes. How to solve this issue?
Avadhesh ChandraHi,
We can lock the table before updating the entries. Two types of locks are there.
1. To lock the entire table. Here when the table is locked by one program, another program will not be able to modify it.
2. To lock the particular record only. Here when the record is locked by one program, the other program can modify records other than the one locked.
For option 1
Use the FM ENQUEUE_E_TABLEE to lock the table and FM DEQUEUE_E_TABLEE to unlock table.
For option 2
Go to SE11. There enter the name of your lock object and create it. Next screen you have to mention which field you want to lock.
For more info. on LOCK OBJECTS go to
http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
If you want to lock the entire table, then use the FM said in option 1 in DO-ENDDO loop.
Run the loop till it gets successful (sy-subrc = 0)
DO.
*Call the FM.
IF sy-subrc = 0.
EXIT.
ENDIF.
ENDDO.
If you want to just try some number of times rather than keep on looping then can use for eg: DO 100 TIMES. -
Ora-04021 timeout occurred while waiting to lock object
Hai All
When adding a column into a table then an error comes error
Error Message:
ORA-04021: timeout occurred while waiting to lock object .....
How it happens ...what is the solution....please help
Shiju..Hi
Identify the session that is using this object, kill it and then perform the ALTER table... or wait until the session that is accessing this table release it.
Rgds
Adnan -
Unable to delete Transport Request which contain locked objects
Hi all,
I need to delete some unusable transport requests but as they contain locked objects, it's not possible to delete them. Release operation is just allowed. After releasing these transport requests, I can not find them any more in queue. Please help to find these transport requests which are released and also provide a solution to delete instead of releasing them.
Thanks in advance,
Sanaz.Hi,
Thank you for the reply.
1. What do you mean by transport request , Shipment Request, Shipment Order or Tour.
A. I mean requests which can be transported between SAP Systems using TMS (Transport Management System).
2. What are the objects which has been locked and due to that you are facing this problem.
A. There are diffrent object types. For examle some customizing have booen done or SAP Note correction has been implemented, ... Therefore some objects have been locked due to these operations
3. Let's say if it's an freight Unit, then Pls confirm that System dump / error is not the cause for this.
A. I have no idea about "Freight Unit".
Thanks,
Sanaz. -
Patch 9239090 - ORA-04021: timeout occurred while waiting to lock object
Hello Guys,
I need help urgently to comlete an upgrade of ebs 12.1.1 to 12.1.3.
We are upgrading ebs 11i to 12i going live this weekend. We have encountered "ORA-04021: timeout occurred while waiting to lock object" on patch 9239090 with two Workers:
In adctrl:
1 Run AutoPatch R120 AFUTLGRS.pls FAILED
2 Run AutoPatch R120 AFUTLOGS.pls FAILED
sqlplus -s APPS/***** @/u02/applfinp/apps/apps_st/appl/admin/OFPROD/out/p001invok.sql
Connected.
create or replace package wf_bes_cleanup AUTHID CURRENT_USER as
ERROR at line 1:
ORA-04021: timeout occurred while waiting to lock object
I have done everything everything imaginable but cannot get pass these 2 failed workers.
1) I have checked are there are no locks blocking on any objects:
select s1.username || '@' || s1.machine
|| ' ( SID=' || s1.sid || ' ) is blocking '
|| s2.username || '@' || s2.machine || ' ( SID=' || s2.sid || ' ) ' AS blocking_status
from v$lock l1, v$session s1, v$lock l2, v$session s2
where s1.sid=l1.sid and s2.sid=l2.sid
and l1.BLOCK=1 and l2.request > 0
and l1.id1 = l2.id1
and l2.id2 = l2.id2 ;
2) I also checked and there is space in the database.
3) From adctrl, I have tried restarting the jobs one by one but the worker 1 hangs at and eventually fails on several (12) attempts.
4) The solution on Doc ID 1291064.1 is not the problem:
SQL> select SUPPLEMENTAL_LOG_DATA_MIN, SUPPLEMENTAL_LOG_DATA_PK, SUPPLEMENTAL_LOG_DATA_UI, FORCE_LOGGING
from v$database;
SUPPLEME SUP SUP FOR
NO NO NO NO
5) Manual execution still gave ORA-04021:
sqlplus -s APPS/apps @/u02/applfinp/apps/apps_st/appl/admin/OFPROD/out/p001invok.sql
sqlplus -s APPS/apps @/u02/applfinp/apps/apps_st/appl/admin/OFPROD/out/p002invok.sql
6) The alert log has no related errors
7) I Finally, after over 6 hours of waiting, I could only get the patch to continue after by using adctrl option 8 to skip these two workers.
After proceeding, I have yet hit two more errors and now stuck:
I have hit another error with the same patch:
create or replace package body FND_LOG as
/* $Header: AFUTLOGB.pls 120 ...
AD Worker error:
ORA-04021: timeout occurred while waiting to lock object
Unable to process file in PACKAGE mode.
Not converting file for Invoker's Rights because it appears to be a package body creation script (based on the filename).
File is: /u02/applfinp/apps/apps_st/appl/fnd/12.0.0/patch/115/sql/AFUTLOGB.pls
AD Worker warning:
Product Data File
/u02/applfinp/apps/apps_st/appl/admin/xniprod.txt
does not exist for product "xni".
This product is registered in the database but the above file does not exist in APPL_TOP. The product will be ignored without error
AD Worker error:
The following ORACLE error:
ORA-04063: package body "APPS.FND_LOG" has errors
ORA-06508: PL/SQL: could not find program unit being called: "APPS.FND_LOG"
ORA-06512: at "APPS.FND_FUNCTION", line 834
ORA-06512: at "APPS.FND_MENU_ENTRIES_C_DELTRG", line 4
ORA-04088: error during execution of trigger 'APPS.FND_MENU_ENTRIES_C_DELTRG'
Can I stop and restart this patch 9239090?Hello,
I later executed the failed jobs or scripts manually (successfully) for the patch to continue
sqlplus -s APPS/apps @/u02/applfinp/apps/apps_st/appl/admin/OFPROD/out/p001invok.sql
sqlplus -s APPS/apps @/u02/applfinp/apps/apps_st/appl/admin/OFPROD/out/p002invok.sql
The patch ended with the following :
The following Oracle Reports objects did not generate successfully:
ap reports/US APXARATE.rdf
ar reports/US ARXCTA.rdf
fa reports/US FASRSVED.rdf
ont reports/US OEXOEORD.rdf
pa reports/US PAXACMPT.rdf
pa reports/US PAXALRUN.rdf
pa reports/US PAXACRPT.rdf
pa reports/US PAXCPGAL.rdf
pa reports/US PAXPCRFD.rdf
The patch execution ended but the patch number is not record in apps.ad_bugs table:
select TO_CHAR(CREATION_DATE,'dd-Mon-yyyy, hh24:mm:ss'), BUG_NUMBER from apps.ad_bugs where bug_number in ('9239090');
no rows selected
JFI
Patches located in ad_applied_patches to which there is no a corresponding record in ad_bugs:
SQL> SELECT a.patch_name, TO_CHAR(max(a.last_update_date),'dd-Mon-yyyy, hh24:mm:ss')
2 FROM applsys.ad_applied_patches a
3 WHERE NOT EXISTS (SELECT '1'
4 FROM ad_bugs b
5 WHERE b.bug_number = a.patch_name)
6 group by a.patch_name;
PATCH_NAME TO_CHAR(MAX(A.LAST_UP
9239090 26-Oct-2013, 00:10:27
AutoConfig 25-Oct-2013, 17:10:51
merger9179588 25-Oct-2013, 11:10:30
merger_post_5903765 27-Apr-2013, 23:04:45
mergeu6678700 25-Oct-2013, 16:10:09
What could have happened that this was not recorded in ad_bugs?
How to I get this recorded in the ad_bugs table?
Thanks
Mathias -
Where do I use These lock object FM's (Enqueue & D? and How do I use them?
I created lock object for user defined table (zconsist). The system automatically created 2 FM's (Enquiue & Dequeue).
I created a new TCode and accessing this with mulitple users to do some updates and inserts in that above table.
I used INSERT ZCONSIST statement in 5 places in my program (4 include programs).
Where do I use These FM's? and How do I use them?
I mean before inserting which FM I need to use? after immediately what fm used?.
every insert statemnt before i need to use the respective fm? so 5 places i need to call the respective FM is it right?
thank in advance.Hi Sekhar,
Lock objects are use in SAP to avoid the inconsistancy at the time of data is being insert/change into database.
SAP Provide three type of Lock objects.
Read Lock(Shared Locked)
protects read access to an object. The read lock allows other transactions read access but not write access to
the locked area of the table
Write Lock(exclusive lock)
protects write access to an object. The write lock allows other transactions neither read nor write access to
the locked area of the table.
Enhanced write lock (exclusive lock without cumulating)
works like a write lock except that the enhanced write lock also protects from further accesses from the
same transaction.
You can create a lock on a object of SAP thorugh transaction SE11 and enter any meaningful name start with EZ Example EZTEST_LOCK.
Use: you can see in almost all transaction when you are open an object in Change mode SAP could not allow to any other user to open the same object in change mode.
Example: in HR when we are enter a personal number in master data maintainance screen SAP can't allow to any other user to use same personal number for changes.
Technicaly:
When you create a lock object System automatically creat two function module.
1. ENQUEUE_<Lockobject name>. to insert the object in a queue.
2. DEQUEUE_<Lockobject name>. To remove the object is being queued through above FM.
You have to use these function module in your program.
check this link for example.
http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
tables:vbak.
call function 'ENQUEUE_EZLOCK3'
exporting
mode_vbak = 'E'
mandt = sy-mandt
vbeln = vbak-vbeln
X_VBELN = ' '
_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.
Normally ABAPers will create the Lock objects, because we know when to lock and how to lock and where to lock the Object then after completing our updations we unlock the Objects in the Tables
http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
purpose: If multiple user try to access a database object, inconsistency may occer. To avoid that inconsistency and to let multiple user give the accessibility of the database objects the locking mechanism is used.
Steps: first we create a loc object in se11 . Suppose for a table mara. It will create two functional module.:
1. enque_lockobject
1. deque_lockobject
before updating any table first we lock the table by calling enque_lockobject fm and then after updating we release the lock by deque_lockobject.
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
GO TO SE11
Select the radio button "Lock object"..
Give the name starts with EZ or EY..
Example: EYTEST
Press Create button..
Give the short description..
Example: Lock object for table ZTABLE..
In the tables tab..Give the table name..
Example: ZTABLE
Save and generate..
Your lock object is now created..You can see the LOCK MODULES..
In the menu ..GOTO -> LOCK MODULES..There you can see the ENQUEUE and DEQUEUE function
Lock objects:
http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm
http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
Match Code Objects:
http://help.sap.com/saphelp_nw2004s/helpdata/en/41/f6b237fec48c67e10000009b38f8cf/content.htm
http://searchsap.techtarget.com/tip/0,289483,sid21_gci553386,00.html
See this link:
http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm
Check these links -
lock objects
Lock Objects
Lock Objects
kindly reward if found helpful.
cheers,
Hema. -
Hello Guru's,
we have a unusual problem in the syslog of our ERP System.
Enqueue: Elem.lock 0 contains unpermitted lock mode . lock object EZBEV_BO
We can't found any note or forum entry to solve this.
We checked SAP Notes: 1324099, 891372, 606425, 447242, 1260601 and searched in the forum, but nothing helpful found.
System Data:
ERP 6.0 / NW7.01 with EHP4
SAP Kernel : 701_REL
created on : Jan 18 2010 21:47:07
Kernel Patch number : 77
Source ID : 0.077
DBSL Patch No. : 075
Database
ORACLE 10.2.0.2
Operating System
AIX 5.3
Can someone help?
regards
Chrisdeveloper error
-
Lock object for Purchase Order
Dear Experts.
I am searching the function module "ENQUEUE_ " , which is for locking & Unlocking
the Purchase order(ekko-ebeln).
Please help me.
Thanks in advance,
Regards,
Rahul.Hi,
Use the Lock object EMEKKOE to Lock and Unloack the Purchase orders
Use this FM to lock
MM_ENQUEUE_DOCUMENT
This is also used in the standard program. While enqueing,
if there is any error (sy-subrc 0), then it means,
that particular purchase order is already locked
Use Fm DEQUEUE_ALL to release all lock at the end of report execution.
Regards,
Shamma
Edited by: Shamma Firdous on Aug 20, 2009 10:22 AM -
Hi,
in standard transaction I lock an object in an other system using RFC lock(enqueue function) but when I exit from transaction the object in other system is automatically unlocked without using the dequeue function.
Is It the correct behaviour?
Thanks,
Max BoscoloHi
Lock objects are use in SAP to avoid the inconsistancy at the time of data is being insert/change into database.
SAP Provide three type of Lock objects.
- Read Lock(Shared Locked)
protects read access to an object. The read lock allows other transactions read access but not write access to
the locked area of the table
- Write Lock(exclusive lock)
protects write access to an object. The write lock allows other transactions neither read nor write access to
the locked area of the table.
- Enhanced write lock (exclusive lock without cumulating)
works like a write lock except that the enhanced write lock also protects from further accesses from the
same transaction.
You can create a lock on a object of SAP thorugh transaction SE11 and enter any meaningful name start with EZ Example EZTEST_LOCK.
Use: you can see in almost all transaction when you are open an object in Change mode SAP could not allow to any other user to open the same object in change mode.
Example: in HR when we are enter a personal number in master data maintainance screen SAP can't allow to any other user to use same personal number for changes.
Technicaly:
When you create a lock object System automatically creat two function module.
1. ENQUEUE_<Lockobject name>. to insert the object in a queue.
2. DEQUEUE_<Lockobject name>. To remove the object is being queued through above FM.
You have to use these function module in your program.
check this link for example.
http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
tables:vbak.
call function 'ENQUEUE_EZLOCK3'
exporting
mode_vbak = 'E'
mandt = sy-mandt
vbeln = vbak-vbeln
X_VBELN = ' '
_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.
Normally ABAPers will create the Lock objects, because we know when to lock and how to lock and where to lock the Object then after completing our updations we unlock the Objects in the Tables
http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
purpose: If multiple user try to access a database object, inconsistency may occer. To avoid that inconsistency and to let multiple user give the accessibility of the database objects the locking mechanism is used.
Steps: first we create a loc object in se11 . Suppose for a table mara. It will create two functional module.:
1. enque_lockobject
1. deque_lockobject
before updating any table first we lock the table by calling enque_lockobject fm and then after updating we release the lock by deque_lockobject.
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
GO TO SE11
Select the radio button "Lock object"..
Give the name starts with EZ or EY..
Example: EYTEST
Press Create button..
Give the short description..
Example: Lock object for table ZTABLE..
In the tables tab..Give the table name..
Example: ZTABLE
Save and generate..
Your lock object is now created..You can see the LOCK MODULES..
In the menu ..GOTO -> LOCK MODULES..There you can see the ENQUEUE and DEQUEUE function
Lock objects:
http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm
http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
Match Code Objects:
http://help.sap.com/saphelp_nw2004s/helpdata/en/41/f6b237fec48c67e10000009b38f8cf/content.htm
http://searchsap.techtarget.com/tip/0,289483,sid21_gci553386,00.html
See this link:
http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm
Check these links -
lock objects
Lock Objects
Lock Objects
Regards
Anji -
Lock Object. Want to see if it's locked.
Hello to everyone.
I have got a question about lock objects.
There is a Z-table in abap dictionary. During the processing of my report some strings from this Z-table are selected. To select strings i use the SELECT statement. But there can appear the situation when two users ( or more) run my transaction, so the same strings can be selected and then processed. To avoid this situation i've created the lock object with cumulative lock mode ( 'X' ) for this Z-table and put the calling of ENQUEUE function into the code. To test the locking i' ve run my report under two different accounts in the debugging mode. And found that when the enqueue function is finished , and the current string should be locked in theory, this string can be easily selected with help of select-statement under another account. (Even when the transactions start with delay.)
How can i lock the string in the Z-table so that it could be selected only once during the earlier launched transaction?
Regards,
alex karpo.Ho alex,
SAP locking is a cooperative locking model. That means that you have to care for what is possible and what is not possible. You may use enqeue module to set lock for key of every object selected.
If there is already a foreign lock, you should delete the entry from the list or table of selected objects (in memory, not in database).
Or do it as SAP does: If there is a foreign lock, the user is informed and the data can be displayed, not changed.
You can always check the lock by trying to set a lock.
Regards,
Clemens -
Hi experts,
I developed a function module to update the confirmations tab of a PO on ME22N screen. Now, I want to have a lock object in the FM so that a user cant make changes while this FM is in use. I do not know if there is any standard lock object for this purpose. I created a lock object in SE11 'EZEKES' since table EKES corresponds to vendor confirmations details. The Enqueue function was called into the program. The code is below:
CALL FUNCTION 'ENQUEUE_EZPHLOCK'
EXPORTING
MODE_EKES = 'E'
MANDT = SY-MANDT
EBELN = ponumber
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3
The problem is, i'm not able to have a lock on the confirmations tab when the FM is in use. Is there any problem with the lock object i have created. The lock mode is Exclusive,Cumulative.
Please help me with this.Code:
""Local Interface:
*" IMPORTING
*" REFERENCE(PONUMBER) TYPE EKKO-EBELN
*" TABLES
*" ITAB STRUCTURE UEKES
TABLES: EKES, EKKO.
DATA: BEGIN OF I_EKKO OCCURS 0,
EBELN LIKE EKKO-EBELN,
END OF I_EKKO.
DATA: X LIKE EKES-ETENS.
data: i_tab like itab occurs 0 with header line.
move itab[] to i_tab[].
DATA: i_ekes LIKE uekes OCCURS 0 WITH HEADER LINE.
SELECT EBELN FROM EKKO INTO TABLE I_EKKO WHERE EBELN = PONUMBER.
IF NOT I_EKKO[] IS INITIAL.
SELECT * FROM EKES INTO TABLE I_EKES
FOR ALL ENTRIES IN I_EKKO
WHERE EBELN = I_EKKO-EBELN.
ENDIF.
select single etens from ekes into x WHERE EBELN = PONUMBER.
x = x + 1.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
DATA: VARKEY LIKE RSTABLE-VARKEY.
CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
MODE_RSTABLE = 'E'
TABNAME = EKES
VARKEY = VARKEY
X_TABNAME = ' '
X_VARKEY = ' '
_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.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT I_TAB. "WHERE EBELN = PONUMBER.
READ TABLE I_TAB.
LOOP AT i_ekes WHERE ebelp EQ ITAB-EBELP "itemnumber
AND ebtyp EQ 'LA'.
i_ekes-menge = ITAB-MENGE. "quantity.
i_ekes-kz = 'U'.
i_ekes-eindt = ITAB-EINDT. "deldate.
I_EKES-XBLNR = ITAB-XBLNR.
i_ekes-erdat = sy-datum.
i_ekes-ezeit = sy-uzeit.
MODIFY i_ekes.
ENDLOOP.
ENDLOOP.
IF sy-subrc NE 0.
LOOP AT I_TAB. "WHERE EBELN = PONUMBER.
READ TABLE I_TAB.
LOOP AT i_ekes WHERE ebelp EQ ITAB-EBELP "itemnumber
AND ebtyp EQ 'AB'.
i_ekes-menge = ITAB-MENGE. "quantity.
i_ekes-ebtyp = 'LA'.
i_ekes-kz = 'I'.
i_ekes-etens = x.
i_ekes-eindt = ITAB-EINDT. "deldate.
I_EKES-XBLNR = ITAB-XBLNR.
i_ekes-erdat = sy-datum.
i_ekes-ezeit = sy-uzeit.
APPEND i_ekes.
ENDLOOP.
ENDLOOP.
ENDIF.
To update the confirmations tab
CALL FUNCTION 'ME_CONFIRMATION_UPDATE'
EXPORTING
I_EBELN = PONUMBER
TABLES
XEKES = i_ekes[].
YEKES = I_EKES[].
IF SY-SUBRC = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ENDIF.
CALL FUNCTION 'DEQUEUE_E_TABLE'
EXPORTING
MODE_RSTABLE = 'E'
TABNAME = EKES.
VARKEY = VARKEY
X_TABNAME = ' '
X_VARKEY = ' '
_SCOPE = '3'
_SYNCHRON = ' '
_COLLECT = ' '
ENDFUNCTION. -
Lock Object: Enqueue and Dequeue
Hi
Im using VB.Net, SAP .Net to do data entry, updates to
SAP R/3.
Now, I need to lock the data during user changes on
particular documents.
What I done is I created a lock object in SE11. Then
it produce 2 functions which are the ENQUEUE and
DEQUEUE.
Since the data reading from Non-SAP, I check for Allow
RFC and my lock mode is Exclusive and Cumulative.
After that, I also created a remote-enabled RFCs to be
call from VB.Net. These RFCs is calling the ENQUEUE
and DEQUEUE.
When I tested in SAP itself, the locking data is
working perfectly. I checked in SM12, it does shows
the locking entry.
But when I try in VB.Net and call the function
modules, it does not shows any entry in SM12. It is
like nothing happen at all.
After that, I do little test. Firstly I lock the data
from SAP then I run VB.Net, and it does shows the
message who is currently locking the data.
Anybody could help me on this?
Thank you.
Regards.See the following extract from documentation. Check if your lock object definition is satisfying all of them.
<i>Reference Fields for RFC-Enabled Lock Objects
The type of an RFC-enabled function module must be completely defined. The parameters of the generated function module therefore have the following reference fields for RFC-enabled lock objects:
Parameters Reference fields
X_<field name> DDENQ_LIKE-XPARFLAG
_WAIT DDENQ_LIKE-WAITFLAG
_SCOPE DDENQ_LIKE-SCOPE
_SYNCHRON DDENQ_LIKE-SYNCHRON
</i>
Here is the link to the documentation
http://help.sap.com/saphelp_46c/helpdata/en/4f/991f82446d11d189700000e8322d00/frameset.htm
Srinivas -
About lock object in Dynpro ABAP
Hi Expert,
We develop the Dynpro ABAP program to modify SAP document on EP,
( like Sales Order, Purchase order...ect. ).
In tranditional ABAP program, we use lock object(lock entry) to lock sigle document( SO, PO.. etc. )
In Dynpro ABAP , how to lock the single document ?You can also use the "ENQUEUE" and "DEQUEUE" function modules to lock records in WDA as well.
Check out the thread [The effect of Session Expiration on Lock Table |The effect of Session Expiration on Lock Table].
Hope it helps.
Maybe you are looking for
-
Adobe 9 Pro - eliminating text from original form
i am taking forms and converting them to PDF's. I am looking for a way to delete orginal material from the PDF. When i open it in word there is only a single line, but when it is converted to a PDF there is two thick lines that show up and one needs
-
i have a 1st generation iphone(jail broken) ios 3.1.3.the appstore disappeared. how can i retrieve it .
-
Hi all, I'm trying to activate a method from the html using javascript. The problem start from the fact that the applet isn't activated when running the html. I used the object tag like this: <form name="Form1"> <OBJECT ID="AudioPlay" WIDTH=50 HEIGHT
-
3rd party Java Application Cannot connect to inter...
3rd party application like gmail, orkut or 160by2 which are java ME application cannot connect to internet in my Nokia 2700 classic, when connecting it only prompts "Application wants use Network. Allow?" like this, I press the allow button still it
-
Take off Rounding in OBIEE Reports
I have a report with 10 columns say, when all values are zero then I need to remove that crresponding row from report. I wrote a filter condition where (col1 != 0 or col2 != 0 or col3 != 0 or.....col10 != 0) I have a value of 0.1 in one of the column