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

regarding ENQUEUE DEQUEUE

Former Member
0 Likes
784

hey guys,

I want to make record level lock for the user entered in the screen Simultaneously.

I have change button and Tablecontrol in screen.

when user enter VBELN and Other values and execute, the retrieved values from

internal table will be popupated in table control at next screen 9100.

I want to lock other user whom tries to make change in this screen or <b>(when he clicks change button in screen)</b>

i did below logic and its not working for me..could you pls help me out.

MAIN PROGRAM******************************************************

SELECT-OPTIONS:S_WADAT FOR LIKP-WADAT_IST.

SELECT-OPTIONS:S_KUNAG FOR LIKP-KUNAG.

SELECT-OPTIONS:S_KUNNR FOR LIKP-KUNNR.

SELECT-OPTIONS:S_LGORT FOR LIPS-LGORT

MATCHCODE OBJECT ZMLG.

SELECT-OPTIONS:S_VGBEL FOR LIPS-VGBEL.

SELECT-OPTIONS:S_VBELN FOR LIKP-VBELN.

SELECT-OPTIONS:S_POSNR FOR LIPS-POSNR.

SELECT-OPTIONS:S_ZBUNK FOR ZSDTB_LOT-ZBUNKTU.

<b>START-OF-SELECTION.</b>

CLEAR:FLG_CHG,

FLG_UPD.

FLG_SAV = C_ON.

<b>PERFORM SEL_DATA.</b> <i>"Fetches data and put into internal table IT_DATA.</i>

CLEAR W_LINE.

DESCRIBE TABLE IT_DATA LINES W_LINE.

IF W_LINE = 0.

MESSAGE ID 'ZPP' TYPE 'S' NUMBER '011'.

ELSE.

<b> CALL SCREEN '9100'. </b>

ENDIF.

  • PERFORM DEQ_TBL.

***************************************************************

FORM SEL_DATA.

...............................

STORED VALUES INTERNAL TABLE IT_DATA.

ENDFORM.

-


*WHEN USER CLICK CHANGE BUTTON in APPLICATION BAR>

MODULE USER_COMMAND_9100 INPUT.

CASE OK_CODE.

WHEN 'CSCG'. "Change button

IF FLG_CHG = C_ON.

CLEAR:FLG_CHG,FLG_SAV.

LOOP AT IT_DATA INTO WA_DATA.

AT END OF VBELN.

<b> PERFORM ENQ_TBL USING WA_DATA.

IF FLG_ERR = C_ON.

EXIT.

ENDIF.</b>

ENDAT.

ENDLOOP.

IF FLG_ERR = C_ON.

<b>MESSAGE ....<.INFORMATION ERROR VBELN LOCKED></b> ENDIF.

IF FLG_UPD = C_ON.

PERFORM INSERT_TBL.

ENDIF.

ELSE.

FLG_CHG = C_ON.

ENDIF.

WHEN 'SAVE'.

IF FLG_UPD = C_ON.

PERFORM INSERT_TBL.

ENDIF.

ENDCASE.

ENDMODULE.

<b>FORM ENQ_TBL USING I_VBELN.

CLEAR FLG_ERR.

CALL FUNCTION 'ENQUEUE_EZSDTB_LOT'

EXPORTING

MODE_ZSDTB_LOT = 'E'

MANDT = SY-MANDT

VBELN = I_VBELN

EXCEPTIONS

FOREIGN_LOCK = 1

SYSTEM_FAILURE = 2

OTHERS = 3

.

IF SY-SUBRC <> 0.

FLG_ERR = C_ON.

ENDIF.</b>ENDFORM. " ENQ_TBL

2 REPLIES 2
Read only

Former Member
0 Likes
567

hi, please descript more details on where the problem is.

Specially the symptom of your problem.

if you want to keep the exclusive access on thoes record, other application should also call 'ENQUEUE_EZSDTB_LOT' to try to get the access authority.

if no, your lock won't be effective.

And if the other application will be runned by a same user account in the SAP sever, you also should check the 'lock mode' of the lock object.

It is cumulative or not.

It's important, because Exclusive locks can be requested by the same transaction more than once and handled successively, but an exclusive but not cumulative lock can only be requested once by a given transaction. All other lock requests are rejected.

Hope it will be helpful

thanks

Read only

0 Likes
567

hey zhenglin,

Thanks for your reply.

i solved my problem. Actually its coding mistake.

btw, I am trying to make record lock for a particular

VBELN values.

As because same user should manipulate the same VBELN record values of the same table.Thats why.

THanks.I will close this thread.

Ambichan.