2013 Apr 23 7:30 AM
Hi ,
When i have set read lock in this table then why it is giving permission for modifying record in this table.
report zlockobject_zmara.
data : itab type table of zmara,
wa like line of itab.
select * from zmara into corresponding fields of table itab.
loop at itab into wa.
call function 'ENQUEUE_EZMARA'
exporting
mode_zmara = 'S'
mandt = sy-mandt
matnr = wa-matnr
* X_MATNR = ' '
* _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 wa-matnr = '000000000000000002'.
wa-ersda = '20130427'.
wa-ernam = 'Second Value'.
modify itab from wa.
modify zmara from table itab.
endif.
endloop.
Hi ,
When i have set read lock in this table then why it is giving permission for modifying record in this table.
report zlockobject_zmara.
data : itab type table of zmara,
wa like line of itab.
select * from zmara into corresponding fields of table itab.
loop at itab into wa.
call function 'ENQUEUE_EZMARA'
exporting
mode_zmara = 'S'
mandt = sy-mandt
matnr = wa-matnr
* X_MATNR = ' '
* _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 wa-matnr = '000000000000000002'.
wa-ersda = '20130427'.
wa-ernam = 'Second Value'.
modify itab from wa.
modify zmara from table itab.
endif.
endloop.
2013 Apr 23 7:49 AM
check http://help.sap.com/saphelp_nw70/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
Lock mode
Defines how to synchronize table record access by several users.
Exclusive Lock
The locked data can be read or processed by one user only. A request for another exclusive lock or for a shared lock is rejected.
Shared Lock
Several users can read the same data at the same time, but as soon as a user edits the data, a second user can no longer access this data. Requests for further shared locks are accepted, even if they are issued by different users, but exclusive locks are rejected.
Exclusive but not Cumulative Lock
Exclusive locks can be requested by the same transaction more than once and handled successively, but an exclusive but not cumulative lock can only be requested once by a given
2013 Apr 23 9:03 AM
Hi
In both locked object we can read data at same time but only one user can edit the data.
means there is no difference in both lock.
pls specify.
2013 Apr 23 7:50 AM
For your user it will allow to change once ur changing other user cannot change same record
2013 Apr 23 8:12 AM
The SAP lock concept does NOT lock actually records in database, you can always (try) update records with open-sql or native sql statements. You are only protected versus report that use the same concept to prevent this. Read some documentation like The SAP Lock Concept (BC-CST-EQ)
So this program is wrongly coded, it should have use an exclusive lock, execute any standard transaction like MM02, and execute SM12 to get an idea of the locks mode used by SAP.
The purpose of "S" shared lock is to allow multiple user to display the record, preventing any other user to "E" exclusively lock the record for update, but it does not allow the current user to update the record.
Regards,
Raymond
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |