TROUBLESHOOTING BEST PRACTICE Sales tax payment Monika Kowalka Escalation Engineer Contents Possible issues with sales tax payment......................................................................................................... 2 Pre-research .................................................................................................................................................. 2 Troubleshooting example 1: User get error message during sales tax payment run: “Account number for transaction type Sales tax does not exist” .................................................................................................... 3 Step 0: Pre-requirements.......................................................................................................................... 3 Step 1: Checking setup .............................................................................................................................. 3 Step 2: Identify the transaction(s) ............................................................................................................ 3 Step 3: Identify the scenario ..................................................................................................................... 9 Step 4: Reproduce on customize environment ...................................................................................... 11 Step 5: Reproduce on standard environment ........................................................................................ 11 Example 2: Sales tax payment voucher is not equal to the posted sales tax transactions ........................ 12 Step 0: Pre-requirements........................................................................................................................ 13 Step 1: Checking setup ............................................................................................................................ 13 Step 2: Identify the transaction(s) .......................................................................................................... 13 Step 3: Identify the scenario ................................................................................................................... 21 Step 4: Reproduce on customize environment ...................................................................................... 23 Step 5: Reproduce on standard environment ........................................................................................ 23 Step 6: Not able to repro on customer application ................................................................................ 23 Example 3: User receive an error: ”Error message: The combination 3800---- is not valid for the account structure Account structure – cee” ............................................................................................................ 24 Useful scripts and jobs ................................................................................................................................ 24 SQL Script 1: Identify all tax transactions that does not have corresponding TaxTransGeneralJournalAccountEntry.................................................................................................... 24 SQL Script 2: Identify all tax transactions with source document line recID, but this source document line does not exist. .................................................................................................................................. 25 AX JOB: Change the TaxPeriod for specific tax transactions................................................................... 25 Possible issues with sales tax payment a. Error message: “Account number for transaction type Sales tax does not exist” b. Difference between sales tax payment voucher and report and in connection in account balance Pre-research Existing fixes for similar problems or issues that can effect on the Sales tax payment feature KB article Version Title 2731462 AX 2012 RTM Sales Tax Payment voucher displays wrong values when purchase order amounts and invoice amounts are different 2779549 AX 2012 R2 Voucher posted in the Sales tax payment process is not complete 2779549 AX 2012 RTM 2839138 AX 2012 RTM 2839138 AX 2012 R2 Voucher posted in Sales tax payment process is incorrect, but the report generated is correct VAT payment transaction is posted incorrectly when sales tax code is set with a currency that is different than the company currency VAT payment transaction is posted incorrectly when sales tax code is set with a currency that is different than the company currency 2861718 AX 2012 R2 2861650 AX 2012 RTM 2861650 AX 2012 R2 Payment journal cannot be posted due to error, "Account number for transaction type Sales tax does not exist" Sales tax payment voucher is generated with incorrect amount when purchase order line price is changed after product receipt and cash discount is obtained with payment Sales tax payment voucher is generated with incorrect amount when purchase order line price is changed after product receipt and cash discount is obtained with payment 2705859 AX 2012 RTM Printing the Sales tax payment report, receive error “Account number for transaction type Sales tax does not exist” 2963585 AX 2012 R2 Tax payment and account structure modification 2963585 AX 2012 R3 2949604 AX 2012 R2 2949604 AX 2012 R3 Tax payment and account structure modification Sales tax payment voucher is not generated when tax code field ‘Pct. Exempt from sales tax’ is set 100 and use tax is posted Sales tax payment voucher is not generated when tax code field ‘Pct. Exempt from sales tax’ is set 100 and use tax is posted 2954023 AX 2012 R2 Sales tax payment in reporting currency 2954023 AX 2012 R3 Sales tax payment in reporting currency 2940211 AX 2012 R2 Sales tax payment report shows updated transactions also in following periods 3008738 AX 2012 R2 3008738 AX 2012 R2 2986812 AX 2012 RTM 2986812 AX 2012 R2 2986812 AX 2012 R3 Not able to post sales tax payment due to error: Account number for transaction type Sales tax does not exist. Sales tax payment voucher does not create the settlement tax transactions if vendor invoice is tax free and invoice is posted in journal If Vendor invoice is deleted in purchase history source document header is deleted and the link with AccountingDistribution is lost If Vendor invoice is deleted in purchase history source document header is deleted and the link with AccountingDistribution is lost If Vendor invoice is deleted in purchase history source document header is deleted and the link with AccountingDistribution is lost 2878451 AX 2012 R2 2852396 AX 2012 RTM 2852396 AX 2012 R2 Able to delete posted free text invoice Purchase order with sales tax code = 0% have no connection between tables TaxTrans and TaxTransGeneralJournalAccountEntry’ Purchase order with sales tax code = 0% have no connection between tables TaxTrans and TaxTransGeneralJournalAccountEntry’ Troubleshooting example 1: User get error message during sales tax payment run: “Account number for transaction type Sales tax does not exist” Step 0: Pre-requirements 1. 2. 3. 4. 5. Full compilation Full CIL generation Database synchronization Re-indexing (optional) Reset usage data and restart AOS Step 1: Checking setup 1. Posting profile setup 2. Ledger account and posting type 3. All accounts need to be in account structure Step 2: Identify the transaction(s) During settlement period, Customer is posting thousands of transactions and identifying which one is causing the problem during debugging or analyzing the data is difficult or even impossible. To minimize the number of records, please follow such procedure on TEST application: 1. GL > Setup > Sales tax > Sales tax settlement periods > 1.1. If current settlement periods have period interval set to Months and number of unit is set to more than 1, change it to 1 and create periods for each month. 1.1.1.Now, run the report and identify the month where the issue occurs. 1.2. If current settlement periods have period interval set to Months and number of unit is set to 1, change the period interval to Days and select number of units: 5 and create periods for each 5 days for specific month where the issue occurs: 1.2.1 Run the report for each 5 days period and locate the first period where the issue occurs. 1.3 If current settlement periods have period interval set to Days and number of unit is set to 5, change the number of units to 1 and create periods for each 1 day for specific month where the issue occurs: 1.3.1 Next run the sales tax payment for each day and locate days where the issue occurs. 1.4 Review the transaction for the days that has been identified in previous steps. 1.4.1 Check posted sales tax transaction in General Ledger > Inquires > Tax > Posted sales tax 1.5 Create new settlement period i.e. TEST for the same period interval (Days) and Number of units (1). 1.6 For the transactions posted in the first identified day, change the tax period. 1.6.1 Option 1: Manually 1.6.1.1 Open developer workspace go to AOT> Data Dictionary >Tables > select TaxTrans > field: TaxPeriod - change the properties: AllowEdit and AllowEditOnCreate to YES and save changes 1.6.1.2 Open table TaxTrans > search for all transactions posted on identified day (field TransDate) and change the TaxPeriod to “TEST” but just for few, i.e. on all with specific Tax Code or where the source is the same (sales order, voucher, purchase order, free text invoice, …) or tax origin (sales tax, cash discount) 1.6.2 Option 2: Tax period modified by script 1.6.2.1 Open developer workspace > AOT > Jobs > create new and write code 1.6.2.2 Run it and check the results Result can be checked in TaxTrans table 1.7 Run again the sales tax payment for the “old” settlement period for the same day and check if the issue still exist. 1.8 If issue occurs, repeat step 1.6 (1 or 2) for next part of transactions posted on the identified day 1.9 If the issue disappear, proceed with below: 1.9.1 Export the transactions to excel just to remember them 1.9.2 Change back the setup and set “TEST” tax period for first one and run the sales tax payment for “Test” period Hint: To do not create new settlement period each time when it will be posted, we can just modify data in Table > TaxReportPeriod Change on the field ”Closed” and “VersionNum” the properties “AllowEdit” and “AllowEditOnCreate” to YES Open the TaxReportPeriod table and unmark checkbox in Closed column and change version form 1 to 0 On “TEST” TaxPeriod After change: Step 3: Identify the scenario After identifying transaction, we have to find out how this transaction has been created. In my example, the issue is coming from the voucher 140000003_042 where taxOrigin is set to cash discount 1. Open General ledger > Inquires > Voucher transaction > filter by the voucher number 1.1. Check the transaction origin 1.2. Check vendor transaction and history on voucher Offset voucher for invoice Offset voucher for second is connected with credit note Conclusion: Voucher for tax cash discount was created after settling invoice with credit note. 1.3. Review the invoice and credit note and find out how it was created Invoice: Credit note Conclusion: It’s a purchase order invoice and credit note Step 4: Reproduce on customize environment Try to create the same transactions, invoice and credit note and settle them. Cash discount voucher should be created. Run the sales tax payment Step 5: Reproduce on standard environment If we can reproduce the issue on customer database, we can try to do it in the same way on standard. Note: Make sure to check the most important parameters Note: Make sure that we test it on the same build number at first Example 2: Sales tax payment voucher is not equal to the posted sales tax transactions Trial Balance before sales tax payment: Sales tax payment voucher > Totals on voucher are not equal posted sales tax transactions VAT19 inVat19 EUS EU19 Account posting -89.44 -290.55 0.00 -54.95 3800 233.55 3805 89.44 3803 54.95 Difference is 290.55 – 233.55 = 57.00 Trial Balance after sales tax payment > Balance on account 3800 is 57.00 Step 0: Pre-requirements 1. 2. 3. 4. 5. Full compilation Full CIL generation Database synchronization Re-indexing (optional) Reset usage data and restart AOS Step 1: Checking setup 1. Posting profile setup 2. Ledger account and posting type 3. All accounts need to be in account structure Step 2: Identify the transaction(s) During settlement period, Customer is posting thousands of transactions and identifying which one is causing the problem is difficult or even impossible during debugging or analyzing the data. To minimize the number of records, please follow such procedure on TEST application: 1. Developer workspace > AOT > Tables > TaxReportPeriod > 1.1 Change on fields ”Closed” and “VersionNum” the properties “AllowEdit” and “AllowEditOnCreate” from NO to YES Save changes 1.2 Open table and find the period where the issue occurs 1.2.1 1.2.2 Change the Closed from TRUE to FALSE Change VersionNum from 1 to 0 Save it and close the table 2. GL > Setup > Sales tax > Sales tax settlement periods > 2.1. If current settlement periods have period interval set to Months and number of unit is set to more than 1, change it to 1 and create periods for each month. 2.1.1.Now, run the report and identify the month where the issue occurs. 2.2. If current settlement periods have period interval set to Months and number of unit is set to 1, change the period interval to Days and select number of units: 5 and create periods for each 5 days for specific month where the issue occurs: Current: After change: 1.2.3 Run the report for each 5 days period and locate the first period where the issue occurs. In out example, the issue occurs in period 10/11 till 10/15 1.3 If current settlement periods have period interval set to Days and number of unit is set to 5, change the number of units to 1 and create periods for each 1 day for specific month where the issue occurs. Note: In our example we have transaction posted on 15th of October, so no need to run this step. 1.3.1 Next run the sales tax payment for each day and locate days where the issue occurs. 1.4 Review the transaction for the days that has been identified in previous steps. We have just two transactions, so it’s easy to identify which one is causing wrong ledger transaction 1.4.1 Check posted sales tax transaction in General Ledger > Inquires > Tax > Posted sales tax 1.5 Create new settlement period i.e. TEST for the same period interval (Days) and Number of units (1). 1.6 For the transactions posted in the first identified day, change the tax period. 1.6.1 Option 1: Manually 1.6.1.1 Open developer workspace go to AOT> Data Dictionary >Tables > select TaxTrans > field: TaxPeriod - change the properties: AllowEdit and AllowEditOnCreate to YES and save changes 1.6.1.2 Open table TaxTrans > search for all transactions posted on identified day (field TransDate) and change the TaxPeriod to “TEST” but just for few, i.e. on all with specific Tax Code or where the source is the same (sales order, voucher, purchase order, free text invoice, …) or tax origin (sales tax, cash discount) 1.6.2 Option 2: Tax period modified by script 1.6.2.1 Open developer workspace > AOT > Jobs > create new and write code 1.6.2.2 Run it and check the results Result can be checked in TaxTrans table 1.7 Run again the sales tax payment for the “old” settlement period and check if the issue still exist. Note: Need to repeat step 1.2 Note 2: Need to reset the period interval on “old” settlement period Sales tax payment voucher for ALL other transaction: Result: Voucher is equal to posted sales tax transactions: VAT19 inVat19 EUS EU19 Account posting 3800 3805 3803 -89.44 -233.55 0.00 -54.95 233.55 89.44 54.95 1.8 If issue occurs, repeat step 1.6 (1 or 2) for next part of transactions posted on the identified day 1.9 If the issue disappear, proceed with below: 1.9.1 Export the transactions to excel just to remember them – transaction with TaxPeriod set to TEST 1.9.2 Change back the setup on all other transactions ad leave “TEST” tax period for first one and run the sales tax payment for “Test” period 1.9.3 Repeat above step till we identify first transactions that is causing the issue for transactions that we saved in Excel Hint: To do not create new settlement period each time when it will be posted, we can just modify data in Table > TaxReportPeriod (Step 1.2) Step 3: Identify the scenario After identifying transaction, we have to find out how this transaction has been created. In our example, the issue is coming from the voucher 110000007_061 where source is set to Purchase order 2. Open General ledger > Inquires > Voucher transaction > filter by the voucher number 2.1. Check the transaction origin 2.2. Check the invoice journal AP > Inquires > Journals > Invoice journal > find our voucher Result: The view distribution and subledger entries is disabled 2.3. Click on posted sales tax and subledger entries Result: Stack trance error Conclusion: There are missing accounting distribution records for sales tax transaction Step 4: Reproduce on customize environment Try to create the same Purchase order and run the sales tax payment, but just for this transaction. This can be done by changing the TaxPeriod Step 5: Reproduce on standard environment If we can reproduce the issue on customer database, we can try to do it in the same way on standard. Note: Make sure to check the most important parameters Note: Make sure that we test it on the same build number at first Step 6: Not able to repro on customer application In our example, the issue could not be repro because the accounting distribution exist. Research in VKB and TFS and find KB 2986812 “If Vendor invoice is deleted in purchase history source document header is deleted and the link with AccountingDistribution is lost” Similar issue has been found for Free text invoice -> KB 2878451 “Able to delete posted free text invoice” Review AP > Inquires > History > Invoice history and matching details and confirm that the PO has been deleted from this form: Missing voucher: 110000007_061 With this information we can try to reproduce the scenario: 1. Create PO 2. Delete PO from Invoice history and matching details (before fix KB 2986812) 3. Run the sales tax payment Example 3: User receive an error: ”Error message: The combination 3800---- is not valid for the account structure Account structure – cee” With the same procedure, we identify that the issue was coming from the voucher where tax amount was equal to 0,00. The root cause was connected with missing TaxTransGeneralJournalAccount entries to this TaxTrans. This has been fixed under KB 2852396 Useful scripts and jobs SQL Script 1: Identify all tax transactions that does not have corresponding TaxTransGeneralJournalAccountEntry select distinct voucher,TRANSDATE,source,taxtrans.DATAAREAID,TAXTRANSGENERALJOURNALACCOUNTENTRY.TAXTR ANS from TAXTRANS left outer join TAXTRANSGENERALJOURNALACCOUNTENTRY on taxtrans.RECID = TAXTRANSGENERALJOURNALACCOUNTENTRY.taxtrans where TAXTRANSGENERALJOURNALACCOUNTENTRY.TAXTRANS is null and TAXTRANS.TAXAMOUNT != '0' order by taxtrans.DATAAREAID Note: Highlighted lines can be change for amount that is equal to 0,00 KB 2852396 Note 2: In case of KB 2852396, in above script we can add “and TAXTRANS.Source = 1” or “and TAXTRANS.Source = 5” because it applies to free text invoices and purchases orders SQL Script 2: Identify all tax transactions with source document line recID, but this source document line does not exist. select TAXTRANS.VOUCHER,TRANSDATE,TAXTRANS.TAXAMOUNT, TAXTRANS.TAXCODE, TAXTRANS.SOURCEDOCUMENTLINE, TAXTRANS.RECID, TaxTRans.SOURCE from TAXTRANS left outer join SOURCEDOCUMENTLINE on TAXTRANS.SOURCEDOCUMENTLINE = SOURCEDOCUMENTLINE.RECID WHERE SOURCEDOCUMENTLINE.RECID IS NULL AND TAXTRANS.SOURCEDOCUMENTLINE != 0 and TaxTRans.TAXAMOUNT != 0 AND TAXTRANS.TRANSDATE between '10/01/2013' and '10/05/2013' order by taxtrans.RECID Note: Highlighted lines can be change for specific period AX JOB: Change the TaxPeriod for specific tax transactions static void TaxPeriod(Args _args) { TaxTrans TaxTrans; ; ttsBegin; while select forUpdate TaxTrans where TaxTrans.TaxCode == "InVAT19" && TaxTrans.TaxOrigin == TaxOrigin::CashDisc && TaxTrans.TransDate == mkDate(08,10,2014) { TaxTrans.TaxPeriod = "TEST"; TaxTrans.update(); } Box::info("Done"); ttsCommit; } “Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability or fitness for a particular purpose. This mail message assumes that you are familiar with the programming language that is being demonstrated and the tools that are used to create and debug procedures."