Skip to main content

Notifications

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.

  • Suggested answer
    Dirk Profile Picture
    on at
    RE: Performance Issue with Report 20 "Calc. and Post VAT Settlement"

    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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 1,234

#2
YUN ZHU Profile Picture

YUN ZHU 1,006 Super User 2025 Season 1

#3
Mansi Soni Profile Picture

Mansi Soni 872

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans