Sie sind auf Seite 1von 3

11/06/13

SAPTechnical.COM - Row level locking of database table

Hom e Qui z Ti ps Tutori a l s Functi ona l Ce rt Q's I nte rvi e w Q's Jobs Te sti m oni a l s Adve rti se Conta ct Us

Document Categories:
ABAPTM
Adobe Forms
ABAP-HR
ALE & IDocs
ALV
BAPI
BASIS
BSP
Business Objects
Business Workflow
CRM NEW
LSMW
SAP Script/Smart Forms
BI/BW
eXchange Infrastructure (XI)
Enterprise Portals (EP)
eCATT
Object Oriented Programming
SAP Query
Userexits/BADIs
WebDynpro for Java/ABAPTM
Others

Row level locking of database table


Find us on Facebook

By Swetabh Shukla, Infosys Technologies


Normally if a person opens table maintenance
generator and tries to maintain the table, no one
else can maintain the same table at the same
time. This is because of table level lock by
default in SAP. Only one user can maintain any
table at a time through SM30 or any transaction
that calls table maintenance generator. In the
tutorial below we will see how to remove table
level lock and apply row level lock. This way any
number of users can modify the table at same
time. But any particular row can be modified by
only one user at a time. We will create a
transaction for this purpose. The transaction will
call our custom report. This custom report will
call the table maintenance generator of the table
after deleting table level lock.
In current example lets create following:

SAPTechnical
Like

SAPTechnica

SAP BODS - B
guide
By Alok Ranjan

Click on Share
like this article

SAP BODS - B
guide
www.saptechn

SAPTECHNICA
share knowled

Report: ZREP_SHUKS3

Ayer a las 2:

Transaction: ZTEST_SHUKS3

What's New?

Table: ZTEST_SHUKS3 with table maintenance generator.

SAP BODS - Beginners guide


Display text vertically (Rotate
text) in Adobe Form
Sending email with multiple
tabs of excel as a single
attachment
Copying Sales Order
attachments to the invoice
How to disable DELETE and
EDIT buttons function in
attachment list
Scheduling background jobs
from the selection screen
Control Recipe/PI sheet
deletion procedure
Shift Note in SAP
SAP Jobs
Offline Workflow Approval in
ECC R/3 without SAP Logon
from E-Mail (Outlook)
Introduction to SAP eCATT run
by SECATT
ABAP Quiz (String Operations)

SAPTechnica

5,111 people like

Using transaction ZTEST_SHUKS3 we will delete the table level lock and put row level lock so that multiple users
can maintain table at same time. Rows locked by one user will not be editable by other user.
1.

Create

table

ZTEST_SHUKS3.

F acebook social plugin

Optimization process of
reading & writing of SAP HR
master data through buffers
ABAP Quiz (LDB)
ABAP Quiz (Events based)
Quiz on Lock Objects
Quiz II on Workflow
Quiz on Workflow
Quiz on Adobe Forms
Insights of code inspector
Quiz on ABAP Data Types
Proxy to file scenario using
AAE - with full configuration

Contribute?
Sample Specs
What's Hot?
2.

Create table maintenance generator for the table.

Web Dynpro for ABAP Tutorials


Join the Mailing List
Enter name and email address below :
Name:

Email:

Subscribe

Unsubscribe

GO

saptechnical.com/Tutorials/ABAP/Lock/Page1.htm

1/3

11/06/13

SAPTechnical.COM - Row level locking of database table

We will make single screen maintenance for this table. Save it. So finally we have table maintenance code
automatically generated in function group ZTEST_SHUKS3.
3.

Create lock object EYTSS_E433SH in SE11. Give it name as EZTEST_SHUKS3.

Now save and activate the Lock object. SAP creates two function modules corresponding to lock object for
enqueue and dequeue of the table.

4.

Now create a report ZREP_SHUKS3 and transaction code ZTEST_SHUKS3 to call this report. This tcode
will call table maintenance generator of table ZTEST_SHUKS3 .

5.

Normally if a person opens table maintenance generator and tries to maintain the table, no one else can
maintain table at the same time. This is because of table level lock by default in SAP. Only one user can
maintain any table at a time. In report ZREP_SHUKS3 we will delete the table level lock and put row level
lock so that multiple users can maintain table at same time. Rows locked by one user will not be editable by
other user. Check the report and comments given below.

*&---------------------------------------------------------------------*
*& Report ZREP_SHUKS3
*&
*&--------------------------------------------------------------------*& Author : Swetabh Shukla
*& Date : 05/22/2009
*& Description : To delete table level lock from table.
*&---------------------------------------------------------------------*
REPORT zrep_shuks3.
**Selection range for view maintenance
DATA:
BEGIN OF selekttab OCCURS 1.
"Selektionsbereich
INCLUDE STRUCTURE vimsellist.
DATA: END OF selekttab,
**Table of inactive CUA functions for view maintenance

saptechnical.com/Tutorials/ABAP/Lock/Page1.htm

2/3

11/06/13

SAPTechnical.COM - Row level locking of database table


**Table of inactive CUA functions for view maintenance
BEGIN OF excl_cua_funct OCCURS 1. "inaktive CUA-Fkt bei View-Pflege
INCLUDE STRUCTURE vimexclfun.
DATA: END OF excl_cua_funct.
DATA: lt_enq_del TYPE STANDARD TABLE OF seqg3,
lt_enq_read TYPE STANDARD TABLE OF seqg7,
lw_enq_read TYPE seqg7,
lw_enq_del TYPE seqg3,
lv_subrc TYPE sy-subrc.
*Read all the lock details in system
CALL FUNCTION 'ENQUE_READ2'
EXPORTING
gclient = sy-mandt
gname = ' '
guname = '*'
TABLES
enq
= lt_enq_read.
*We will search entry for table level lock for our table
LOOP AT lt_enq_read INTO lw_enq_read
WHERE gname EQ 'RSTABLE'
AND garg CS 'ZTEST_SHUKS3'.
MOVE-CORRESPONDING lw_enq_read TO lw_enq_del.
APPEND lw_enq_del TO lt_enq_del.
ENDLOOP.
*Delete table level lock entry for our table
CALL FUNCTION 'ENQUE_DELETE'
EXPORTING
check_upd_requests = 1
IMPORTING
subrc
= lv_subrc
TABLES
enq
= lt_enq_del.
*Now call the table maintenace generator.
CALL FUNCTION 'VIEW_MAINTENANCE_CALL'
EXPORTING
action
= 'U'
view_name
= 'ZTEST_SHUKS3'
show_selection_popup = 'X'
TABLES
dba_sellist
= selekttab
excl_cua_funct
= excl_cua_funct.
Click here to continue...

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM


Home Contribute About Us Privacy Terms Of Use Disclaimer Safe Companies: Advertise on SAPTechnical.COM | Post Job Contact Us
2006-2007 SAPTechnical.COM. All rights reserved.
All product names are trademarks of their respective companies. SAPTechnical.COM is in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver, and and any other SAP trademarks are registered trademarks of SAP AG in Germany and in several other countries.
Every effort is made to ensure content integrity. Use information on this site at your own risk.

Graphic Design by Round the Bend Wizards

saptechnical.com/Tutorials/ABAP/Lock/Page1.htm

3/3

Das könnte Ihnen auch gefallen