I drafted this up a while ago and never got time to finish it, but here it is for what it's worth
Can I delete a department or location?
The only time when a department can be deleted is when it is not associated to investment, resource, location, chargeback rules, not referenced in ppa_wip, and not used in financial plans (in 13.x) .
To check if a department/location is referenced in WIP, run the following query:
select project_code from ppa_wip
where DEPARTCODE = 'YOUR_DEPARTMENT_CODE'
or EMPLYHOMEDEPART = 'YOUR_DEPARTMENT_CODE
or PROJECT_DEPARTMENT = 'YOUR_DEPARTMENT_CODE
group by project_code
If it returns a non-zero value then the reference exists
The only time a record is removed from WIP is when the Purge Financial Tables job is run against the project. The job permanently delete financial plans and financial transactions (WIP) from the selected project. WIP reversal, adjustment, or transfer will not do it
To check if a department/location is used in any financial plan, run the following query:
I dont' have it yet, if you have one ready please put it here (it would be similiar to what I've posted in my Tuesday Tip today)
To see if any investment or resources are associated to the department or location:
Go to the Department or Location properties page > Investments tab, click Show All; do the same on the Resources tab.
On any investment or resource instance shown on the tabs, you can change the department and location values from the financial properties page. For investments you can only change department to another one within the same entity if the investment has any financial plan; you would also need to make sure this investment doesn't have any transaction on the Invalid Transactions page, or waiting to be posted to WIP
finally, the query against prj_obs_associations would be something like (warning: this query has not been tested, but just to give an idea of which tables to look into):
select poa.table_name TypeOfAssociation, poa.record_id InternalIDOfTheAssociatedInstance, pou.name, pot.unique_name OBSName
from prj_obs_associations poa, prj_obs_units pou, prj_obs_types pot, prj_obs_object_types poot, entity e
where poa.unit_id = pou.id
and pou.type_id = pot.id
and pot.id = poot.type_id
and e.org_chart_obs_type_id = pou.type_id
and pou.unique_name = 'DEPT001' --the code of the department
the associations table stores investments, resources, as well as locations that a department obs unit is associated to, see the Tech Ref guide for details.