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

Table Maintenance

Former Member
0 Likes
632

Hi ,

When we use table maintenance transaction the entire table is locked , even if the user resticts the records .

Is there some way by which only that set of records get locked which are being used by the user , so that other users can modify the balance data.

Regards,

Arun

6 REPLIES 6
Read only

Former Member
0 Likes
610

Arun

It is not possible.

The only solution is to create a simple report with table for showing data and additional screen for entering and changing data. This way you can lock only the record that user is currently editing.

Rgds

Mat

Read only

Former Member
0 Likes
610

Hai.

Use enque ,deque functionality in your program.

Use

CALL FUNCTION 'ENQUEUE_E_TABLE'

EXPORTING

MODE_RSTABLE = C_E

TABNAME = C_INTERM

varkey =

EXCEPTIONS

FOREIGN_LOCK = 1

SYSTEM_FAILURE = 2

OTHERS = 3

.

CASE SY-SUBRC.

WHEN 1.

MESSAGE E000 WITH 'Table'(021) C_INTERM

'is locked by other user'(022).

WHEN 2.

MESSAGE E000 WITH 'Table'(021) C_INTERM

'can not be updated due to sytem failure'(023).

WHEN 3.

MESSAGE E000 WITH 'Table'(021) C_INTERM

'can not be updated due to unknown error'(024).

ENDCASE.

CALL FUNCTION 'DEQUEUE_E_TABLE'

EXPORTING

MODE_RSTABLE = C_E

TABNAME = C_INTERM.

in above for a table take what are the primary and foreign key comination and concatenate the values and pass ir to varkey .then that particular records will be locked.

regards.

sowjanya.b

Read only

Former Member
0 Likes
610

Hi

try if this code can help u.

&----


*& Report ZLOCKING *

*& *

&----


*& *

*& *

&----


REPORT zlocking .

DATA : tab_emp TYPE TABLE OF zemp_51772,

wa_emp TYPE zemp_51772.

wa_emp-emp_no = '102'.

wa_emp-emp_id = '157'.

wa_emp-emp_name = 'SIVA'.

wa_emp-emp_dept = 'SAP'.

APPEND wa_emp TO tab_emp.

CLEAR wa_emp.

wa_emp-emp_no = '128'.

wa_emp-emp_id = '138'.

wa_emp-emp_name = 'RAMA'.

wa_emp-emp_dept = 'SAP'.

APPEND wa_emp TO tab_emp.

CLEAR wa_emp.

wa_emp-emp_no = '133'.

wa_emp-emp_id = '121'.

wa_emp-emp_name = 'KRISHNA'.

wa_emp-emp_dept = 'SAP'.

APPEND wa_emp TO tab_emp.

CLEAR wa_emp.

CALL FUNCTION 'ENQUEUE_E_TABLEE'

EXPORTING

mode_rstable = 'X'

tabname = 'ZEMP_51772'

  • varkey =

  • X_TABNAME = ' '

  • X_VARKEY = ' '

  • _SCOPE = '2'

  • _WAIT = ' '

  • _COLLECT = ' '

EXCEPTIONS

foreign_lock = 1

system_failure = 2

OTHERS = 3

.

IF sy-subrc EQ 0.

INSERT zemp_51772 FROM TABLE tab_emp.

ENDIF.

CALL FUNCTION 'DEQUEUE_E_TABLEE'

EXPORTING

mode_rstable = 'X'

tabname = 'ZEMP_51772'

  • VARKEY =

  • X_TABNAME = ' '

  • X_VARKEY = ' '

  • _SCOPE = '3'

  • _SYNCHRON = ' '

  • _COLLECT = ' '

.

IF sy-subrc EQ 0.

WRITE:/ 'Unlocked the Table'.

ENDIF.

Thanks & Regards,

Sravani.

Read only

0 Likes
610

Hi ,

Thanks for the reply , but my issue is in table maintenance the entire table gets locked , i want to restrict the locking only to records selected by the user.

Regards

Arun

Read only

prabhu_s2
Active Contributor
0 Likes
610

when one table is edited or maintained other users dont have the previledge to modify the table contents for the entire table. Hence in this case i hope that u cannot restrict the authroization at record level

Read only

Former Member
0 Likes
610

What you are asking is possible but not feasible.Database generally contains millions of records under different table

The time taken to keep track of a record level lock and authenicate query involving that particular table is very huge.Performance wise the system will become unusable to say the least.