Tablelocking issue

GilGil Member Posts: 49
Hi. Can anyone give me help how to not give me an error when waiting for table to be not tablelocked.

Here is my code for a button:
recGenJnlLine.SETRANGE("Student No.", Rec.SDMSID);
recGenJnlLine.SETRANGE("Journal Template Name", 'CASH RECEI');
recGenJnlLine.SETRANGE("Journal Batch Name", CurrForm.subform1.FORM.GetCurrBatch2);
  vBatchName2 := CurrForm.subform1.FORM.GetCurrBatch2;

Now on the subform(Cash Receipts Journal) the post rec function is:
    CODEUNIT.RUN(CODEUNIT::"Gen. Jnl.-Post",recGenJnlLine);
    CurrentJnlBatchName := GETRANGEMAX("Journal Batch Name");

i'm wondering how to not return an error instead it would just continue posting till the table is ready.
So i think maybe i could use the locktimeout(true)? and set the time lockout to 60 seconds(for testing purpose)
Can anyone give me a hand in this.


  • Options
    GilGil Member Posts: 49
    hmmm i have searched for a bit, it seems there is no solution to deadlocks in my case.

    Is it really NAV's standard when for example 2 users try to post a journal at the same time to tablelock/deadlock?
  • Options
    jglathejglathe Member Posts: 639
    Hi Gil,

    I would recommend to use CU13 "Gen. Jnl.-Post Batch" instead of posting each journal line separately. It contains all the locking and preliminary checks. This should avoid the locking problem (among others).

    with best regards

  • Options
    DenSterDenSter Member Posts: 8,304
    There is a HUGE difference between a table lock and a deadlock. You need to learn the difference if you want to be effective in troubleshooting.
Sign In or Register to comment.