Documente Academic
Documente Profesional
Documente Cultură
2.
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.
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
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.
Just one more change in table maintenance screen. Now open table maintenance function
group(ZTEST_SHUKS3) in SE80.We know for table maintenance SAP automatically creates code in
the function group. Now we will make some modification in that existing code to change the behavior.
Open the screen you created through table maintenance and add one module.
Open the screen 0001 and add one module in PBO of the screen as shown in figure below.
Now we are ready for testing. Call the transaction once and make some entries in table. In below
screenshot I have entered some random values. Since we have not maintained any check tables etc,
so values may be invalid. That can be taken care in real scenario.
Save data.
Lets call two sessions of the transaction ZTEST_SHUKS3.
Session 1
In first session we will call the transaction ZTEST_SHUKS3 and try to open some existing values for table
maintenance.
Session 2
Open transaction ZTEST_SHUKS3
So we can see that our transaction is able to achieve a row level locking and has removed table level
locking.