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

Lock objects

Former Member
0 Likes
724

Hi,

I have created lock objects on a ztable using all its primary keys:

VKORG

VBELN

DATE

I need to insert records into the ztable from internal table.

In the internal I will have one VKORG through out internal table & Date will be sy-datum always. But I will have different values of VBELN.

Table entries are For eg:

VKORG VBELN DATE

GR16 1 15.07.2009

GR16 2 15.07.2009

GR16 3 15.07.2009

Please let me know if it is fine to use Lock object without VBELN field by commenting VBELN at the time of calling FM.

CALL FUNCTION 'ENQUEUE_/EUR/EOGR_PRINT'

EXPORTING

mode_/eur/ogrt_print = l_c_e

mandt = sy-mandt

vkorg = 'GR16'

  • vbeln =

datum = SY-DATUM

EXCEPTIONS

foreign_lock = 1

system_failure = 2

OTHERS = 3.

Or please let me know the best way to use this FM.

Regards,

Shraddha

6 REPLIES 6
Read only

sivasatyaprasad_yerra
Product and Topic Expert
Product and Topic Expert
0 Likes
685

If you use like this, then you are acquiring locks on all 3 rows which is not correct becuase you are stopping others to work with other records which differs only in VBLEN value. So, it is better to use all the key fields while acquring any locks on record.

Regards,

Siva.

Read only

0 Likes
685

Hi Shiva,

How can I do so when I have various entries in VBELN.

Even if I take all VBELN in a range and pass it to the FM, if a lock fails for one entry I will not be able to update whole internal table.

Please let me know how to deal with these scenarios.

Regards,

Shraddha

Read only

0 Likes
685

In this case, you can actually use FM like whatever you have mentioned in first memo.

Read only

0 Likes
685

Hi,

But is this right to use like this. I mean I am just blocking other VBELN to be updated.

Regards,

Shraddha

Read only

0 Likes
685

When you are not sure which entries you will be updating, then you need to lock all the entries. Or else you can call this FM individually for all the objects which will be part of your internal table. SO, that you will be blocking only those which you might update.

Read only

0 Likes
685

hi,

the thing wht u did is right only use the lock object. with out giving vbeln field then it will lock other entries which is having same date and vkorg except vbeln. udate table. what wrong ur getting their.

regards

rajesh varma.