Dynamics 365 Business Central: Bank Revaluation, Realized or Unrealized?

A common question I receive from accountants during new project implementations is why bank currency revaluation is recorded under ‘Realized’ rather than ‘Unrealized’ gains or losses.

If you are familiar with IFRS, in IAS 21, foreign currency transactions (which can include bank balances in a foreign currency) are accounted for based on exchange rates at the time of the transaction and revalued using the exchange rate at the balance sheet date. This revaluation creates unrealized exchange differences unless the foreign currency transaction is settled (realized).

Unfortunately, there is no clear explanation from Microsoft as to why the standard behaviour of bank revaluation posts to ‘Realized’ rather than ‘Unrealized.’

Without customization, accountants will have to pass journal entry to reclass from realized to unrealized.

How can we handle?

Luckily for us, Microsoft provided events to change the GL Account No., let me show you how to find them!

If we run through report 595 “Adjust Exchange Rates”, we can see that the report is calling PostBankAccAdjmt function to post the entries.

trigger OnAfterGetRecord()
begin
    BankAccNo := BankAccNo + 1;
    Window.Update(1, Round(BankAccNo / BankAccNoTotal * 10000, 1));

    TempDimSetEntry.Reset();
    TempDimSetEntry.DeleteAll();
    TempDimBuf.Reset();
    TempDimBuf.DeleteAll();

    CalcFields("Balance at Date", "Balance at Date (LCY)");
    CurrAdjBase := "Balance at Date";
    CurrAdjBaseLCY := "Balance at Date (LCY)";
    CurrAdjAmount :=
      Round(
        CurrExchRate.ExchangeAmtFCYToLCYAdjmt(
          PostingDate, Currency.Code, "Balance at Date", Currency."Currency Factor")) -
      "Balance at Date (LCY)";

    if CurrAdjAmount <> 0 then begin
        PostBankAccAdjmt("Bank Account");

        TotalAdjBase := TotalAdjBase + CurrAdjBase;
        TotalAdjBaseLCY := TotalAdjBaseLCY + CurrAdjBaseLCY;
        TotalAdjAmount := TotalAdjAmount + CurrAdjAmount;
        Window.Update(4, TotalAdjAmount);
    end;
end;

In this procedure, the system will get the Account No. from the GetRealizedGainsAccount or GetRealizedLossesAccount before posting the revaluation entries.

if CurrAdjAmount <> 0 then begin
    GetDimSetEntry(GetDimCombID(TempDimBuf), TempDimSetEntry);
    if CurrAdjAmount > 0 then
        AccNo := GetRealizedGainsAccount(Currency)
    else
        AccNo := GetRealizedLossesAccount(Currency);
    PostAdjmt(
        AccNo, -CurrAdjAmount, CurrAdjBase, BankAccount."Currency Code", TempDimSetEntry, PostingDate, '');
end;

If we look into these functions, we can see that Microsoft has provided an OnBefore event, allowing us to modify the GL Account No..

local procedure GetRealizedGainsAccount(Currency: Record Currency) AccountNo: Code[20]
var
    IsHandled: Boolean;
begin
    IsHandled := false;
    OnBeforeGetRealizedGainsAccount(Currency, AccountNo, IsHandled);
    if IsHandled then
        exit(AccountNo);

    exit(Currency.GetRealizedGainsAccount());
end;

Code

Now, we will subscribe to these events and set the AccountNo to our unrealized GL account using the mentioned function.

codeunit 50000 "Event"
{
    [EventSubscriber(ObjectType::Report, Report::"Adjust Exchange Rates", OnBeforeGetRealizedGainsAccount, '', false, false)]
    local procedure "Adjust Exchange Rates_OnBeforeGetRealizedGainsAccount"(Currency: Record Currency; var AccountNo: Code[20]; var IsHandled: Boolean)
    begin
        IsHandled := true;
        AccountNo := Currency.GetUnrealizedGainsAccount();
    end;

    [EventSubscriber(ObjectType::Report, Report::"Adjust Exchange Rates", OnBeforeGetRealizedLossesAccount, '', false, false)]
    local procedure "Adjust Exchange Rates_OnBeforeGetRealizedLossesAccount"(Currency: Record Currency; var AccountNo: Code[20]; var IsHandled: Boolean)
    begin
        IsHandled := true;
        AccountNo := Currency.GetUnrealizedLossesAccount();
    end;
}

Note: report 595 “Adjust Exchange Rates” will be deprecated and replaced with report 596 “Exch. Rate Adjustment”.
Luckily, the functions is still available.

  • Dynamics 365 Business Central: Introduction to Warehouse Management Part 1
  • Dynamics 365 Business Central: Interim Accounts – Income or Balance Sheet?
  • Dynamics 365 Business Central: How to Migrate Open Foreign Invoices
  • Dynamics 365 Business Central: How to post Reclassification using Recurring General Journal