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

enqueue/dequeue problem

Former Member
0 Likes
1,510

Hi,

I created lock object "ez_z001" for the table "z001", called

function module "enqueue_ez_z001" to lock the record, and the

the return code sy-subrc = 0, but I still can edit the record in another

session/program.

Please kindly advise what the problem is.

Thanks and best regards.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,063

How you are calling FM ?

CALL FUNCTION 'ENQUEUE_EMPLAFE'

EXPORTING

plnum = i_plaf-plnum -> Give your ztable field

<b> _scope = '3'</b>

EXCEPTIONS

foreign_lock = 2

system_failure = 3.

See the above FM ,How i am calling

Unlock

CALL FUNCTION 'DEQUEUE_EMPLAFE'

EXPORTING

plnum = i_plaf-plnum. -> give ztable field here

Thanks

Seshu

6 REPLIES 6
Read only

Former Member
0 Likes
1,064

How you are calling FM ?

CALL FUNCTION 'ENQUEUE_EMPLAFE'

EXPORTING

plnum = i_plaf-plnum -> Give your ztable field

<b> _scope = '3'</b>

EXCEPTIONS

foreign_lock = 2

system_failure = 3.

See the above FM ,How i am calling

Unlock

CALL FUNCTION 'DEQUEUE_EMPLAFE'

EXPORTING

plnum = i_plaf-plnum. -> give ztable field here

Thanks

Seshu

Read only

0 Likes
1,063

Hi, Seshu ,

Thank you very much for the answer.

I called the FM as follows:

data: wk_prno like Z001-prno.

wk_prno = '1000000001'.

CALL FUNCTION 'ENQUEUE_EZ_Z001'

EXPORTING

mode_Z001 = 'E'

mandt = sy-mandt

prno = wk_prno

  • X_PRNO = ' '

  • _SCOPE = '2'

  • _WAIT = ' '

  • _COLLECT = ' '

EXCEPTIONS

foreign_lock = 1

system_failure = 2

OTHERS = 3

Please kindly advise again.

Thanks and best regards.

Read only

0 Likes
1,063

You welcome tt.

data: wk_prno like Z001-prno.

wk_prno = '1000000001'.

  • Locking

CALL FUNCTION 'ENQUEUE_EZ_Z001'

EXPORTING

*mode_Z001 = 'E'

*mandt = sy-mandt

prno = wk_prno

  • X_PRNO = ' '

_SCOPE = '3'

  • _WAIT = ' '

  • _COLLECT = ' '

EXCEPTIONS

foreign_lock = 1

system_failure = 2

OTHERS = 3

.

  • Unlocking

CALL FUNCTION 'DEQUEUE_EZ_Z001''

EXPORTING

prno = wk_prno.

Good luck

Thanks

Seshu

Read only

0 Likes
1,063

Hi, Seshu,

Thank you very much for your answer.

I tried according to your advise. But It didn't work. After the return code sy-subrc = 0, I still can edit the record via tcode SE16.

Please kindly advise again.

Thanks and best regards.

Read only

0 Likes
1,063

hello tt,

You did not mention table record at SE16 ,It is not possible to keep locking at record level in SE16 Transaction but you can keep locking record at transaction level ( if you have dialog program)

otherway you can lock complete table if you use below

Lock FM - 'ENQUEUE_E_TABLE'

Unlock FM - 'DEQUEUE_E_TABLE'

Here i am using ZTEST99 Table and i am able to lock complete table

REPORT ZSAI1.

tables : ztest99.

start-of-selection.

CALL FUNCTION 'ENQUEUE_E_TABLE'

EXPORTING

MODE_RSTABLE = 'E'

TABNAME = 'ZTEST99'

  • VARKEY =

  • X_TABNAME = ' '

  • X_VARKEY = ' '

  • _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.

break sy-uname.

CALL FUNCTION 'DEQUEUE_E_TABLE'

EXPORTING

  • MODE_RSTABLE = 'E'

TABNAME = 'ZTEST99'

  • VARKEY =

  • X_TABNAME = ' '

  • X_VARKEY = ' '

  • _SCOPE = '3'

  • _SYNCHRON = ' '

  • _COLLECT = ' '

.

Thanks

Seshu

Read only

0 Likes
1,063

Hi, Seshu,

Thank you very much for your expertise.

The problem was solved according to your advise.

Thanks and best regards.