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: 

How to lock the perticular record in table with some of fields

Former Member
0 Kudos

Hi,

I have one Doubt please clarify me.

How to lock the record in table with perticular fields combination please give me example of code.

Thanks,

Hari.

5 REPLIES 5

former_member404244
Active Contributor
0 Kudos

hi,

You can lock a table using FM:' ENQUEUE_E_TABLE' or if you want to a particular record, then you need to find out the lock object and the corresponding FMs for that table.

Regards,

Nagaraj

Former Member
0 Kudos

Hi,

IT LIKE this....

This is the function mode that you have to create for locking the contents of you internal table.

CALL FUNCTION 'ENQUEUE_EZHFINDID'

EXPORTING

mode_zhfindid = 'E'

mandt = sy-mandt

ownid = w_display-ownid

  • X_OWNID = ' '

  • _SCOPE = '2'

  • _WAIT = ' '

  • _COLLECT = ' '

EXCEPTIONS

foreign_lock = 1

system_failure = 2

OTHERS = 3.

CASE sy-subrc.

WHEN 1.

w_flag_lock = c_x.

  • CLEAR w_okflag.

MESSAGE e265 WITH w_display-ownnum.

ENDCASE.

Jayant Sahu.

Former Member
0 Kudos

Use ENQUEUE_TABLEE to lock.

To lock a particular record, use parameter VARKEY in ENQUEUE_TABLEE.

Pass the unique key of the record to VARKEY

Former Member
0 Kudos

Hi,

You can not lock single record.

maintaining another table for the particular field combination you are talking about would do the job.

Former Member
0 Kudos

helo,

we can lock single entry by using lock mechanism.

i have done in one scenario.

req is batch creation at prduction order level(co01).

batch is of 10 digits.

so it was on condition for (pro year,crop code,pro location,staus code) like this.

for this we mantained one z field with some fields ok.so for this table we need to lock one user from generation one number with another user same number .

for this we created one lock object for that table in e mode.

and used the default function modules created by system it worked record level.

(enqeue and deque fm created by system)

IN THE LOCK PARAMETERS GIVE THE KEY FIELDS FOR WHICH U WANT TO LOCK FOR RECORD LEVEL