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 Records using a field that is not part of the primary key

Former Member
0 Kudos

Morning,

I have created a lock object for a table and then called the ENQUEUE function module to lock records. Unfortunately I want to lock records based upon a field that is not included within the primary key of the table. As the field is not part of the primary key it is not one of the parameters for the function module.

The 2 solutions I can come up with are as follows:-

Solution 1

1. Read the records into an internal table.

2. Lock the corresponding records.

3. Read the records into another internal table and then compare the 2 internal tables.

Disadvantage of this solution

1. Have to perform an additional read and perform a internal table comparison.

2. I am reading before locking.

Solution 2

1. Include the field in the primary key of the table.

Disadvantage of this solution

1. The field should not be part of the primary key.

Any additional useful suggestions would be appreciated.

Regards

John.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi!

In Soulution 1, the 2.nd disagvantage can be eliminated, if you read the corresponding records one more after the locking. This means a double read for the same data, but some performance loss may cause a better and stable work for your module.

Anyways, the 1st solution is much more "friendly" for me...

Regards

Tamá

2 REPLIES 2

Former Member
0 Kudos

Hi!

In Soulution 1, the 2.nd disagvantage can be eliminated, if you read the corresponding records one more after the locking. This means a double read for the same data, but some performance loss may cause a better and stable work for your module.

Anyways, the 1st solution is much more "friendly" for me...

Regards

Tamá

0 Kudos

Tamás,

Thanks for your feedback.

Regards

John.