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: 

Locking a particular row in a table control

Former Member
0 Kudos
449

Hi All,

I have module pool program in which table control is used. I would like to know whether it is possible to lock a particular row in the table so that another person will not be able to edit it until the first user completes his work. It should be only for that particular record which is being currently edited in the table.

2 REPLIES 2

Former Member
0 Kudos
83

Hi,

Yes you can lock particular row in a table control..

In the flow logic..

PROCESS BEFORE OUTPUT.

  LOOP AT itab INTO wa WITH CONTROL tc.

     MODULE disable_row.

  ENDLOOP.

  MODULE disable_row.

* call the Enqueue function module..If the 
    IF sy-subrc NE 0.
      LOOP AT screen.
           SCREEN-INPUT = 0.    " Disable for input
           MODIFY SCREEN.
      ENDLOOP.

   ENDIF.

  ENDMODULE.

Thanks

Naren

Former Member
0 Kudos
83

You cannot do it at Table control's record level, but you can do it at Database Table's record level as follows:

Go to SE11 and create a lock:

>Create a lock with name starting with EZ* or EY*

>Enter name of table, whose record is to be locked

>Make lock type to be exclusive

>In lock parameters, give all primary keys of the table

>On saving, activating two Function Modules are created names EZxxx_ENQUEUE, EZxxx_DEQUEUE

Now If you want to lock a particular record

>Call FM EZxxx_ENQUEUE and pass primary key values of the record to be locked

To unlock table record

>Call FM EZxxx_DEQUEUE and pass primary key values of the record to be unlocked

Edited by: Amit Gupta on Nov 15, 2008 6:14 PM