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/Unlock Table

Former Member
0 Likes
1,877

Hi,

I want to lock the custom table to do the updation from program,

I have created the lock objects for that table and i am using the enqueue and dequeue function modules in the program.

Now how i can test this locking happeing or not?

Moderator message: "urgently" not permitted

The following is the code i am using in th program

CALL FUNCTION 'ENQUEUE_EZFAMEX_IBCP'

EXPORTING

  • mode_zfamex_ibcp = 'E'

  • client = sy-mandt

land1 = p_land1

  • x_land1 = 'X'

  • _SCOPE = '2'

  • _WAIT = ' '

  • _COLLECT = ' '

EXCEPTIONS

foreign_lock = 1

system_failure = 2

OTHERS = 3.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Regards

Krishna

Hi,

I want to lock the custom table to do the updation from program,

I have created the lock objects for that table and i am using the enqueue and dequeue function modules in the program.

Now how i can test this locking happeing or not?

Moderator message: "urgently" not permitted

The following is the code i am using in th program

CALL FUNCTION 'ENQUEUE_EZFAMEX_IBCP'

EXPORTING

  • mode_zfamex_ibcp = 'E'

  • client = sy-mandt

land1 = p_land1

  • x_land1 = 'X'

  • _SCOPE = '2'

  • _WAIT = ' '

  • _COLLECT = ' '

EXCEPTIONS

foreign_lock = 1

system_failure = 2

OTHERS = 3.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Regards

Krishna

6 REPLIES 6
Read only

Former Member
0 Likes
847

Hi,

Try to access the entries from the table that you have locked.

Find in SM12 whether the entries are locked then you can conform.

Cheers!!

VEnk@

Read only

0 Likes
847

Hi,

I found 'no lock entries found' in SM12.

what i did i put a break-point at the function module and i have checked in SM12.

Thanks

Krishna

Read only

0 Likes
847

Hi,

After using the function module ENQUEUE_E_TABLE.

Try to print whether the table is locked or not where you can conform.

call function 'ENQUEUE_E_TABLE'

exporting

tabname = '<tablename>'

varkey = varkey

exceptions

foreign_lock = 1

system_failure = 2

others = 3

.

If sy-subrc = 0.

write: 'successfully locked the table'.

else.

write: 'not locked'.

endif.

Cheers!!

VEnk@

Read only

0 Likes
847

Hi,

Thanks for you imeediate reply,

But i did not see the Tabname parameter in my FM exporting parameters

I am only getting keyfield parameter in my exporting.

Regards

Krishna

Read only

0 Likes
847

Hi Krishan,

There is a difference you have to notice here if you use the FM CALL FUNCTION 'ENQUEUE_EZFAMEX_IBCP' " here you have to create the lock object and then call the function module.

According to the FM (call function 'ENQUEUE_E_TABLE')i have used there is no need to create any lock object separately, directly you can lock the table itself with out creating lock object.

Hope you got my answer. Therefore call FM call function 'ENQUEUE_E_TABLE' and give your table in TABNAME it will automatically lock your table.

Cheers!!

VEnk@

Read only

0 Likes
847

hi

Try to access the entries from the table that you have locked.