AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 01.12.2016, 21:13   #1  
Blog bot is offline
Blog bot
Участник
 
25,626 / 848 (80) +++++++
Регистрация: 28.10.2006
stoneridgesoftware: I Can’t Delete An Account In My Dynamics AX Chart of Accounts
Источник: https://stoneridgesoftware.com/i-can...t-of-accounts/
==============

When building your chart of accounts in Microsoft Dynamics AX, you’ll likely find that accounts may need to be deleted because it’s no longer needed or was entered in error. If transactions exist for the account, deleting the account is not an option. However, if there’s no transactions for the account you’d like to delete, you may see an error message that prevents deleting the account. Here’s an example of this scenario, and a couple of options to remove the account from the chart of accounts.

Let’s say we notice there’s a duplicate “Petty Cash” account. When I attempt to delete the account, I receive an error stating “A financial dimension value is based on the 110181 record and has been used on a transaction. You cannot delete the 110181 record.”



If I review the posted transactions of the account, I can see no transactions have been posted this account. The reason AX is not allowing me to delete this account is because it was either selected on a posting profile, such as Accounts for automatic transactions, Customer/Vendor posting profiles, or Inventory posting (to name a few), or it was selected on a journal line – even if the line was deleted and the journal was never posted.

When an account is defined in a configuration, the system generates records in the following tables that prevent the account from being deleted:

• DIMENSIONATTRIBUTEVALUEGROUPCOMBINATION• DIMENSIONATTRIBUTEVALUEGROUP• DIMENSIONATTRIBUTELEVELVALUE• DIMENSIONATTRIBUTEVALUE• DIMENSIONATTRIBUTEVALUECOMBINATIONThe following queries will confirm no transactions have been posted on the account to be deleted, and will show the records in the above tables preventing deletion. Replace 110181 with the account number that’s to be deleted.

--VALIDATES NO LEDGER TRANSACTIONS HAVE BEEN POSTED.SELECT * FROM GENERALJOURNALACCOUNTENTRY GJAE INNER JOIN DIMENSIONATTRIBUTEVALUECOMBINATION DAVC ON GJAE.LEDGERDIMENSION = DAVC.RECID INNER JOIN MAINACCOUNT MA ON DAVC.MAINACCOUNT = MA.RECID INNER JOIN LEDGERCHARTOFACCOUNTS LCOA ON MA.LEDGERCHARTOFACCOUNTS = LCOA.RECID INNER JOIN LEDGER L ON L.CHARTOFACCOUNTS = LCOA.RECIDWHERE MA.MAINACCOUNTID IN ('110181')--After the above returns no results, we can select the records that need to be deleted using the following queries:--SELECTS DIMENSIONATTRIBUTEVALUEGROUPCOMBINATION RECORDSSELECT * FROM DIMENSIONATTRIBUTELEVELVALUE DALV INNER JOIN DIMENSIONATTRIBUTEVALUE DAV ON DALV.DIMENSIONATTRIBUTEVALUE = DAV.RECID INNER JOIN DIMENSIONATTRIBUTEVALUEGROUP DAVG ON DALV.DIMENSIONATTRIBUTEVALUEGROUP = DAVG.RECID INNER JOIN DIMENSIONATTRIBUTEVALUEGROUPCOMBINATION DAVGC ON DAVGC.DIMENSIONATTRIBUTEVALUEGROUP = DAVG.RECIDWHERE DAV.RECID IN ( SELECT RECID FROM DIMENSIONATTRIBUTEVALUE WHERE ENTITYINSTANCE IN ( SELECT MA.RECID FROM MAINACCOUNT MA INNER JOIN LEDGERCHARTOFACCOUNTS LCOA ON MA.LEDGERCHARTOFACCOUNTS = LCOA.RECID INNER JOIN LEDGER L ON L.CHARTOFACCOUNTS = LCOA.RECID WHERE MA.MAINACCOUNTID IN ('110181') ) )--SELECTS DIMENSIONATTRIBUTEVALUEGROUP RECORDSSELECT * FROM DIMENSIONATTRIBUTELEVELVALUE DALV INNER JOIN DIMENSIONATTRIBUTEVALUE DAV ON DALV.DIMENSIONATTRIBUTEVALUE = DAV.RECID INNER JOIN DIMENSIONATTRIBUTEVALUEGROUP DAVG ON DALV.DIMENSIONATTRIBUTEVALUEGROUP = DAVG.RECIDWHERE DAV.RECID IN ( SELECT RECID FROM DIMENSIONATTRIBUTEVALUE WHERE ENTITYINSTANCE IN ( SELECT MA.RECID FROM MAINACCOUNT MA INNER JOIN LEDGERCHARTOFACCOUNTS LCOA ON MA.LEDGERCHARTOFACCOUNTS = LCOA.RECID INNER JOIN LEDGER L ON L.CHARTOFACCOUNTS = LCOA.RECID WHERE MA.MAINACCOUNTID IN ('110181') ) )--SELECTS DIMENSIONATTRIBUTELEVELVALUE RECORDSSELECT * FROM DIMENSIONATTRIBUTELEVELVALUE DALV INNER JOIN DIMENSIONATTRIBUTEVALUE DAV ON DALV.DIMENSIONATTRIBUTEVALUE = DAV.RECIDWHERE DAV.RECID IN ( SELECT RECID FROM DIMENSIONATTRIBUTEVALUE WHERE ENTITYINSTANCE IN ( SELECT MA.RECID FROM MAINACCOUNT MA INNER JOIN LEDGERCHARTOFACCOUNTS LCOA ON MA.LEDGERCHARTOFACCOUNTS = LCOA.RECID INNER JOIN LEDGER L ON L.CHARTOFACCOUNTS = LCOA.RECID WHERE MA.MAINACCOUNTID IN ('110181') ) )--SELECTS DIMENSIONATTRIBUTEVALUE RECORDSSELECT * FROM DIMENSIONATTRIBUTEVALUE WHERE ENTITYINSTANCE IN ( SELECT MA.RECID FROM MAINACCOUNT MA INNER JOIN LEDGERCHARTOFACCOUNTS LCOA ON MA.LEDGERCHARTOFACCOUNTS = LCOA.RECID INNER JOIN LEDGER L ON L.CHARTOFACCOUNTS = LCOA.RECID WHERE MA.MAINACCOUNTID IN ('110181') )--SELECTS DIMENSIONATTRIBUTEVALUECOMBINATION RECORDSSELECT * FROM DIMENSIONATTRIBUTEVALUECOMBINATION DAVC INNER JOIN MAINACCOUNT MA ON DAVC.MAINACCOUNT = MA.RECIDWHERE MA.RECID IN ( SELECT MA.RECID FROM MAINACCOUNT MA INNER JOIN LEDGERCHARTOFACCOUNTS LCOA ON MA.LEDGERCHARTOFACCOUNTS = LCOA.RECID INNER JOIN LEDGER L ON L.CHARTOFACCOUNTS = LCOA.RECID WHERE MA.MAINACCOUNTID IN ('110181') )--The above shows the records to be deleted – spot check the results to ensure there’s nothing out of the ordinary.Only if the first query returns no results should you consider proceeding to the next scripts. If the DIMENSION tables return any results, these records must be deleted in order to allow deleting the main account. Always be sure to use a development environment and backup the databases before deleting records. The following will delete the records preventing deletion of the main account:

--DELETES DIMENSIONATTRIBUTEVALUEGROUPCOMBINATION RECORDSDELETE DAVGC FROM DIMENSIONATTRIBUTELEVELVALUE DALV INNER JOIN DIMENSIONATTRIBUTEVALUE DAV ON DALV.DIMENSIONATTRIBUTEVALUE = DAV.RECID INNER JOIN DIMENSIONATTRIBUTEVALUEGROUP DAVG ON DALV.DIMENSIONATTRIBUTEVALUEGROUP = DAVG.RECID INNER JOIN DIMENSIONATTRIBUTEVALUEGROUPCOMBINATION DAVGC ON DAVGC.DIMENSIONATTRIBUTEVALUEGROUP = DAVG.RECIDWHERE DAV.RECID IN ( SELECT RECID FROM DIMENSIONATTRIBUTEVALUE WHERE ENTITYINSTANCE IN ( SELECT MA.RECID FROM MAINACCOUNT MA INNER JOIN LEDGERCHARTOFACCOUNTS LCOA ON MA.LEDGERCHARTOFACCOUNTS = LCOA.RECID INNER JOIN LEDGER L ON L.CHARTOFACCOUNTS = LCOA.RECID WHERE MA.MAINACCOUNTID IN ('110181') ) )--DELETES DIMENSIONATTRIBUTEVALUEGROUP RECORDSDELETE DAVG FROM DIMENSIONATTRIBUTELEVELVALUE DALV INNER JOIN DIMENSIONATTRIBUTEVALUE DAV ON DALV.DIMENSIONATTRIBUTEVALUE = DAV.RECID INNER JOIN DIMENSIONATTRIBUTEVALUEGROUP DAVG ON DALV.DIMENSIONATTRIBUTEVALUEGROUP = DAVG.RECIDWHERE DAV.RECID IN ( SELECT RECID FROM DIMENSIONATTRIBUTEVALUE WHERE ENTITYINSTANCE IN ( SELECT MA.RECID FROM MAINACCOUNT MA INNER JOIN LEDGERCHARTOFACCOUNTS LCOA ON MA.LEDGERCHARTOFACCOUNTS = LCOA.RECID INNER JOIN LEDGER L ON L.CHARTOFACCOUNTS = LCOA.RECID WHERE MA.MAINACCOUNTID IN ('110181') ) )--DELETES DIMENSIONATTRIBUTELEVELVALUE RECORDSDELETE DALV FROM DIMENSIONATTRIBUTELEVELVALUE DALV INNER JOIN DIMENSIONATTRIBUTEVALUE DAV ON DALV.DIMENSIONATTRIBUTEVALUE = DAV.RECIDWHERE DAV.RECID IN ( SELECT RECID FROM DIMENSIONATTRIBUTEVALUE WHERE ENTITYINSTANCE IN ( SELECT MA.RECID FROM MAINACCOUNT MA INNER JOIN LEDGERCHARTOFACCOUNTS LCOA ON MA.LEDGERCHARTOFACCOUNTS = LCOA.RECID INNER JOIN LEDGER L ON L.CHARTOFACCOUNTS = LCOA.RECID WHERE MA.MAINACCOUNTID IN ('110181') ) )--DELETES DIMENSIONATTRIBUTEVALUE RECORDSDELETE FROM DIMENSIONATTRIBUTEVALUE WHERE ENTITYINSTANCE IN ( SELECT MA.RECID FROM MAINACCOUNT MA INNER JOIN LEDGERCHARTOFACCOUNTS LCOA ON MA.LEDGERCHARTOFACCOUNTS = LCOA.RECID INNER JOIN LEDGER L ON L.CHARTOFACCOUNTS = LCOA.RECID WHERE MA.MAINACCOUNTID IN ('110181') )--DELETES DIMENSIONATTRIBUTEVALUECOMBINATION RECORDSDELETE DAVC FROM DIMENSIONATTRIBUTEVALUECOMBINATION DAVC INNER JOIN MAINACCOUNT MA ON DAVC.MAINACCOUNT = MA.RECIDWHERE MA.RECID IN ( SELECT MA.RECID FROM MAINACCOUNT MA INNER JOIN LEDGERCHARTOFACCOUNTS LCOA ON MA.LEDGERCHARTOFACCOUNTS = LCOA.RECID WHERE MA.MAINACCOUNTID IN ('110181') )Once these are deleted, I can now delete the ledger account. If the account being deleted still exists on a configuration somewhere, the account will need to be removed and the correct account assigned to the configuration.

*Please Note: Always be sure to use a development environment and backup the databases before deleting records.







Источник: https://stoneridgesoftware.com/i-can...t-of-accounts/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
emeadaxsupport: AX Performance Troubleshooting Checklist Part 2 Blog bot DAX Blogs 0 09.09.2014 16:11
emeadaxsupport: In Microsoft Dynamics AX 2012 the Default account setup Lookup form is listing Main Accounts from all Company Accounts rather than just active Company Accounts Blog bot DAX Blogs 0 20.03.2012 19:11
dynamicsaxtraining: Purchase Blog bot DAX Blogs 0 11.03.2012 05:25
dynamics-ax: Interview with Microsoft's Lachlan Cash on his new role, AX 2012 and more Blog bot DAX Blogs 6 22.04.2011 14:55
dynamics-ax: Official Details about Dynamics AX '6' released, including comments from Microsofts Kees Hertogh Blog bot DAX Blogs 0 11.01.2011 05:22

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 02:23.