Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Slow purchase invoice entry in purchase invoice journal

Posted on by 60

Environment: Dynamics Ax 2012R3CU13
In our France entity, the purchase invoice journal (Accounts payable/Journals/Invoices/Invoice journal) is significantly slower compared to the other entities, f.e. German, Dutch, Swiss. When enabling the SQL trace the following query is the reason for the additional waiting time during invoice entry.
SELECT TOP 1 T1.RECID FROM LEDGERJOURNALTRANS T1 WHERE
(
 (
  (PARTITION=5637144576) AND (DATAAREAID=N'fr')
 ) AND
 (
  (
   ((JOURNALNUM=?) AND
    (
     (
      (TAXGROUP<>?) AND (TAXITEMGROUP<>?)
     ) OR (TAXCODE<>?)
    )
   ) OR (TDSGROUP_IN<>?)
  ) OR (TCSGROUP_IN<>?)
 )
)

In the solution reponse of https://community.dynamics.com/ax/f/microsoft-dynamics-ax-forum/147168/purchase-order-line-very-slow-update-after-editing the same query is mentioned with a change to the statement, add additional parentheses to the statement.

Somehow this did solve the problem but I don't understand why it did, and changing a standard Ax statement/method is not really upgrade friendly. If I run the query direct in SQL, with the questionmarks replaced with the actual data, it takes 30 seconds to get the result. I tried to add the parentheses in the query but still the query takes 30 seconds, which strikes me as odd. Additional: when I remove the TDSGroup_IN and TCSGROUP_IN from the statement in SQL the result is instant, < 1 second.

Furthermore I have looked into why this code is used in France but not in the other entities, but so far haven't found the parameter, class, or method. One mayor difference between the France entity and the other entities is the setup of Conditional Tax. This is only set for France.

Can the code in LedgerJournalTaxDocument.doTaxGroupExistsForDocument_Server be viewed as a bug? Is code the same in Dynamics 365 F&O?
Does anyone had this issue before and found another reason for the additional delay during purchase invoice entry for a specific entity?
Any information shared regarding my problem is welcome and much appreciated.

*This post is locked for comments

  • Aartserp Profile Picture
    Aartserp 60 on at
    RE: Slow purchase invoice entry in purchase invoice journal

    I've tested all kinds of scenario's and figured out it is the Check sales tax group [General ledger>Setup>General ledger parameters>Sales tax] which makes the application go to LedgerJournalTaxDocument.doTaxGroupExistsForDocument_Server. If the setting is set to None, line 24 of Tax.skipTaxCalculations is activated and through this eventually the query in doTaxGroupExistsForDocument_Server is started.

    For us the setting in Check sales tax group isn't really relevant so we will set this to warning and have the performance issue solved. But since the performance of the query can be increased by adding parentheses it feels this could be reported as a bug, if this code is still relevant in D365 F&O.

  • Aartserp Profile Picture
    Aartserp 60 on at
    RE: Slow purchase invoice entry in purchase invoice journal

    Hi Ludwig, Thank you for the additional question.

    We do not have an entity in India, nor have we the localization configuration for India enabled. 

    All countries have the same journal setup for the vendor invoice recording. The numbersequence is always set to In connection with balance, all journals have approval activated. No other setup is done on the journal.

    When comparing the German entity with the France entity I only see a difference in the VAT setup (conditional tax) and invoice matching validation (AP>Setup>Parameters>Invoice validation>Enable invoice matching validation. I will test if this will make a difference.

    I will post the result after the test.

    Regards,

    Remco

  • Verified answer
    Ludwig Reinhard Profile Picture
    Ludwig Reinhard Microsoft Employee on at
    RE: Slow purchase invoice entry in purchase invoice journal

    Hi,

    Have you already compared the setup of the French with the German invoice journal?

    Are the configurations different for example in regards to the use of number sequences and their allocation at the time of posting?

    Do you have a legal entity in India?

    If this is not the case, can you possibly disable the Indian localizations and see if this results in a performance difference?

    Best regards,

    Ludwig

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans