web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Performance Issue with Report 20 "Calc. and Post VAT Settlement"

(0) ShareShare
ReportReport
Posted on by 10

Our client ist using the following version: CH Business Central 16.1 (Platform 16.0.12630.12758 + Application 16.1.12805.0)

When using standard report 20 "Calc. and Post VAT Settlement" for one quarter we have a performance issue. Even after 10 hours the report has not finished. With the help of the SQL profiler I found the bottle neck. It is the following lines of code:

// Close current VAT entries
if PostSettlement then begin
   VATEntry.ModifyAll("Closed by Entry No.", NextVATEntryNo);
   VATEntry.ModifyAll(Closed, true);
end;

I realized that BC is not using the correct key on the VAT entry table. There are about 97'000 records to be closed. The table contains a total of 4.1 Mio. records. I came up with the following workaround:

if PostSettlement then begin
   VATEntry.SetCurrentKey("Posting Date", Type, Closed, "VAT Bus. Posting Group", "VAT Prod. Posting Group");
   VATEntry.ModifyAll("Closed by Entry No.", NextVATEntryNo);
   VATEntry.ModifyAll(Closed, true);
end;

I copied the standard report and added the above key. This key is defined in the VAT entry table:

        key(Key14; "Posting Date", Type, Closed, "VAT Bus. Posting Group", "VAT Prod. Posting Group", Reversed, "G/L Account No.")

        {
            SumIndexFields = Base, Amount, "Unrealized Amount", "Unrealized Base", "Additional-Currency Base", "Additional-Currency Amount", "Add.-Currency Unrealized Amt.", "Add.-Currency Unrealized Base", "Remaining Unrealized Amount";
        }

With this workaround the report finished in about 15 minutes. However what I don't understand is why BC is not automatically using the correct key. It should not be necessary to explicitly specify the correct key. Is there any setting (maybe in the SQL server) that causes this behaviouir? I have also checked the index fragmentation for the VAT Entry table. It is around 4%.

Any help will be appreciated.

I have the same question (0)
  • Suggested answer
    Dirk Profile Picture
    Microsoft Employee on at

    I cannot comment on the technical details, but v16 is out of support already and the last CU for v16 was CU17.

    v17 will be our of support starting April 2022

    If you still face performance issue in v17 or v18 (latest CU) then please create a service request at Microsoft

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 580 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 480 Super User 2026 Season 1

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 261 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans