/** Sample Code with the mentioned scenario **/ /* *************************** Definitions ************************** */ DEFINE BUTTON upd-samp LABEL "Update Sample". DEFINE BUTTON exit-app LABEL "Exit". DEFINE QUERY seq-samp FOR Sample. DEFINE BROWSE brow-samp QUERY seq-samp DISPLAY Sample.SampId Sample.SampleName WITH 10 DOWN. /* ******************** Preprocessor Definitions ******************** */ /* *************************** Main Block *************************** */ FORM exit-app SKIP(1) brow-samp WITH FRAME main-frame. FORM Sample.SampId Sample.SampleName WITH FRAME curr-frame COLUMN 40. OPEN QUERY seq-samp FOR EACH Sample. ON MOUSE-SELECT-DBLCLICK OF BROWSE brow-samp DO: /* TRANSACTION */ RUN UPD-REC. END. ENABLE ALL WITH FRAME main-frame. APPLY "VALUE-CHANGED" TO brow-samp. PAUSE 0 BEFORE-HIDE. WAIT-FOR CHOOSE OF exit-app OR WINDOW-CLOSE OF DEFAULT-WINDOW. /* ********************** Internal Procedures *********************** */ PROCEDURE FRAME-UPDATE: /*------------------------------------------------------------------------------ Purpose: display a frame to update the record. Notes: ------------------------------------------------------------------------------*/ ON GO OF FRAME CURR-FRAME DO: ASSIGN Sample.SampleName. /** Uncomment the below statement to assign the value when Pause statement is used, Since the widgets are not enabled with wait-for **/ /** ASSIGN Sample.SampleName = "abcd". **/ END. /*UPDATE Sample.SampId Sample.SampleName WITH FRAME cuRR-frame VIEW-AS DIALOG-BOX TITLE "SAMPLE UPDATE".*/ DISPLAY Sample.SampId Sample.SampleName WITH FRAME CURR-FRAME. FRAME CURR-FRAME:SENSITIVE = TRUE. ENABLE ALL WITH FRAME CURR-FRAME. WAIT-FOR GO OF FRAME CURR-FRAME. /* PAUSE 5. APPLY "GO" TO FRAME CURR-FRAME. */ END PROCEDURE. PROCEDURE UPD-REC: /*------------------------------------------------------------------------------ Purpose: To fetch the record in shared lock. Notes: ------------------------------------------------------------------------------*/ GET CURRENT seq-samp. RUN FRAME-UPDATE. END PROCEDURE.
When the WAIT-FOR executes, the browse is getting an ENTRY event which is causing it to refresh the current record with the default locking (no-lock), so when you go update it, it does not have the lock anymore. You can avoid that from happening by doing an APPLY ENTRY to a fill-in CURR-FRAME right before the WAIT-FOR.
Thanks Fernando for your valuable input. Its working fine.