Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Error in Payment Journal - NAV 2009

Posted on by 23,116

This is a very odd error happened to one of our clients. Sometimes when they try to open Payment Journal this error get pop up and then we have to use our developer license and recompile the form. Once we recompile it works fine for few days and then suddenly it throw this error once again.  They are using Dynamics NAV 2009 (Version W1 6.00 (6.00.29626)).

Following is the code in the page.

Form - OnInit()

Form - OnOpenForm()

BalAccName := '';
OpenedFromBatch := ("Journal Batch Name" <> '') AND ("Journal Template Name" = '');
IF OpenedFromBatch THEN BEGIN
  CurrentJnlBatchName := "Journal Batch Name";
  GenJnlManagement.OpenJnl(CurrentJnlBatchName,Rec);
  EXIT;
END;
GenJnlManagement.TemplateSelection(FORM::"Payment Journal",4,FALSE,Rec,JnlSelected);
IF NOT JnlSelected THEN
  ERROR('');
GenJnlManagement.OpenJnl(CurrentJnlBatchName,Rec);

Form - OnCloseForm()

Form - OnQueryCloseForm() : Boolean

Form - OnActivateForm()

Form - OnDeactivateForm()

Form - OnFindRecord(Which : Text[1024]) : Boolean

Form - OnNextRecord(Steps : Integer) : Integer

Form - OnAfterGetRecord()
ShowShortcutDimCode(ShortcutDimCode);

Form - OnAfterGetCurrRecord()
GenJnlManagement.GetAccounts(Rec,AccName,BalAccName);
UpdateBalance;

Form - OnBeforePutRecord()
UpdateBalance;

Form - OnNewRecord(BelowxRec : Boolean)
UpdateBalance;
SetUpNewLine(xRec,Balance,BelowxRec);
CLEAR(ShortcutDimCode);


*This post is locked for comments

  • TharangaC Profile Picture
    TharangaC 23,116 on at
    RE: Error in Payment Journal - NAV 2009

    Thank you very much for the prompt replies.  

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Error in Payment Journal - NAV 2009

    Good!!

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Error in Payment Journal - NAV 2009

    Please verify the answer if it satisfy your question.

    Please do the same... 

  • TharangaC Profile Picture
    TharangaC 23,116 on at
    RE: Error in Payment Journal - NAV 2009

    Glathe,

    Thank you for the information and as usual very detailed and very clear. I will check and confirm the resolution.

    I think this will work fine.

  • Verified answer
    Jens Glathe Profile Picture
    Jens Glathe 6,092 on at
    RE: Error in Payment Journal - NAV 2009

    Hi Tharanga,

    a guess: You have payment batches that have a bank set as balancing account, and of those probably one that has USD (or any currency code) set for this bank? This might be the source of the problem. Imagine this scenario:

    1. You work in the payment journals. You hav ea batch selected that has a FCY bank a balancing account.

    2. You have a filter set on the form, no lines are shown

    3. You close the page / form

    4. You open th epayment journal again and get your error.

    The reason behind this is this combination:

    - balancing account is a bank account with a currency

    - OnOpenForm finds no entry (for whatever reason), the page/form goes into OnNewRecord() and tries to create a new one. xRec in this case is empty.... no date!

    - SetupNewLine() in T81 will find an entry, and will use xRec (given as parameter LastGenJnlLine) into this function. So the date will be 0D.

    - In the end, the balancing account will be validated, and you will find no exchange rate, because there is no date.

    What's the workaround:

    In T81, SetupNewLine() should check if there is a valid date in "Posting Date". Like this:

    SetUpNewLine(LastGenJnlLine : Record "Gen. Journal Line";Balance : Decimal;BottomLine : Boolean)
    GenJnlTemplate.GET("Journal Template Name");
    GenJnlBatch.GET("Journal Template Name","Journal Batch Name");
    GenJnlLine.SETRANGE("Journal Template Name","Journal Template Name");
    GenJnlLine.SETRANGE("Journal Batch Name","Journal Batch Name");
    IF GenJnlLine.FIND('-') THEN BEGIN
      "Posting Date" := LastGenJnlLine."Posting Date";
      "Document Date" := LastGenJnlLine."Posting Date";
      "Document No." := LastGenJnlLine."Document No.";
      IF BottomLine AND
         (Balance - LastGenJnlLine."Balance (LCY)" = 0) AND
         NOT LastGenJnlLine.EmptyLine
      THEN
        "Document No." := INCSTR("Document No.");
    END ELSE BEGIN
      "Posting Date" := WORKDATE;
      "Document Date" := WORKDATE;
      IF GenJnlBatch."No. Series" <> '' THEN BEGIN
        CLEAR(NoSeriesMgt);
        "Document No." := NoSeriesMgt.TryGetNextNo(GenJnlBatch."No. Series","Posting Date");
      END;
    END;
    //OS001 os.jgl
    if "Posting Date" = 0D then
      "Posting Date" := WORKDATE;
    if "Document Date" = 0D then
      "Document Date" := WORKDATE;
    //OS001e os.jgl  
    IF GenJnlTemplate.Recurring THEN
      "Recurring Method" := LastGenJnlLine."Recurring Method";
    "Account Type" := LastGenJnlLine."Account Type";
    "Document Type" := LastGenJnlLine."Document Type";
    "Source Code" := GenJnlTemplate."Source Code";
    "Reason Code" := GenJnlBatch."Reason Code";
    "Posting No. Series" := GenJnlBatch."Posting No. Series";
    "Bal. Account Type" := GenJnlBatch."Bal. Account Type";
    IF ("Account Type" IN ["Account Type"::Customer,"Account Type"::Vendor,"Account Type"::"Fixed Asset"]) AND
       ("Bal. Account Type" IN ["Bal. Account Type"::Customer,"Bal. Account Type"::Vendor,"Bal. Account Type"::"Fixed Asset"])
    THEN
      "Account Type" := "Account Type"::"G/L Account";
    VALIDATE("Bal. Account No.",GenJnlBatch."Bal. Account No.");
    Description := '';

    This should avoid this error, because you have a valid posting date before validating the balancing account.

    with best regards

    Jens

  • TharangaC Profile Picture
    TharangaC 23,116 on at
    RE: Error in Payment Journal - NAV 2009

    If this happen to all the users then it can be a configuration problem in exchange rate.

  • TharangaC Profile Picture
    TharangaC 23,116 on at
    RE: Error in Payment Journal - NAV 2009

    Thank you very much for the prompt feedback. I have check this and they have entered exchange rate properly for the given date.

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Error in Payment Journal - NAV 2009

    Please do check

  • TharangaC Profile Picture
    TharangaC 23,116 on at
    RE: Error in Payment Journal - NAV 2009

    If it is a problem with the configuration then it cannot be recovered once we compile the form, also I check the setup and it is ok.

    I would even say it is a problem with the configuration if this happen to all the users. This only happen with random users.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Error in Payment Journal - NAV 2009

    Chandrasekara,

    I think the error may be due to configuration problem..

    See whether Currency Exchange Rates have been recorded in the required window.

    Search "Currencies"

    Exchange Rate Group>> Exch. Rates

    Enter Starting date and other details there.

    Thank You,

    JO

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans