Application Development 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: 

Row level locking of database table

Former Member
0 Kudos
298

We have a requirement where in multiple users should be allowed to maintain the table at the same time. We have created a program which removes the table level lock and applies row level lock and allows the users to change the entries at the same time, which is working fine. But the problem is that when the first user is changing an entry in the table, then the subsequent user is not able to create a new entry in the table.

Any pointers would be appreciated.

Thanks in advance,

Sirisha

7 REPLIES 7

rodrigo_paisante3
Active Contributor
0 Kudos
133

Hi,

If you create a temporary table (itab) to save new data when this case happens and before the user leave the program try to insert new rows. Let me know if this solution is good for you.

Regards

0 Kudos
133

Hi,

When one user is changing an entry in the table, then for the subsequent users the New entries screen opens in the Display mode. Is it a function module which does the locking of the table when creating new entries, if yes, then how do we unlock the table(by changing the parameters passed to the function module)?

My program also works for 'copy from' option to create new entries..but it doesn't work when the subsequent user clicks on 'New entries' button(screen opens in dispay mode).

Thanks,

Sirisha

0 Kudos
133

The Issue is resolved.

Thanks,

Sirisha

0 Kudos
133

Hi sirisha,

Can you please post the solution.

once issue gets resolve, Please try to give the soultion.

thanks

Vinod

0 Kudos
133

Hi All,

Sorry for not posting the reply earlier, was busy that time but I had a reminder in my mind to post the solution.

Please check SAPTechnical to achieve row level locking of database table. I have made a little modification in the code in PBO module. ( IF sy-ucomm NE 'NEWL' then open screen in Display mode.)

MODULE m_change_locking OUTPUT.

*Call the function module corresponding to the lock object we created

CALL FUNCTION 'ENQUEUE_EZTEST_SHUKS3'

EXPORTING

matnr = ztest_shuks3-matnr

werks = ztest_shuks3-werks

EXCEPTIONS

foreign_lock = 1

system_failure = 2

OTHERS = 3.

IF sy-subrc NE 0.

IF sy-ucomm NE 'NEWL'.

  • row is locked..hence gray..

LOOP AT SCREEN.

screen-input = 0.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

ENDIF.

ENDMODULE. " m_change_locking OUTPUT

Regards,

Sirisha

0 Kudos
133

Thanks a lot for the excellent solution , As i was also getting the same issue and was trying hard to resolve the issue .

Thanks alot .

0 Kudos
133

Hi Sirisha ,

I have developed a row level locking and as per solution which you have provided , its working for new entreis also .

Now i ahve a requirement to display each row details in another screen .To acheive this i have created another screen .

But the here is even the locked row will be editable in the second screen . My requirement is locked row in first screen should be greyout in the second screen .

Appreciate your help and support .

Thanks,

NJ