Its easier to do this with an org hierarchy.
In this organization hierarchy business units are orange, departments are green, and cost centers are red. Based on this hierarchy, when the finance department is selected in a transaction, the system should only allow either the Procurement, or the Administration cost centers.
Link the organization hierarchy to the relevant account structures.
Navigate to General ledger > Setup > Chart of accounts > Configure account structures, and select an account structure that you want to link to the hierarchy.
Click the Edit button.
Click the Relationships button.
The “Select relationships” form shows all of the published organization hierarchies with the purpose “Organization chart” and includes a record representing each relationships between the various financial dimensions in that hierarchy.
To control the selection of department based on business unit, include the record where Party A = BusinessUnit and Party B = Department.
To control the selection of cost centers based on department include the record where Party A = Department and Party B = CostCenter.
Click the OK button.
Activate the account structure by clicking the Activate button.
Once you’ve activated the account structure (and that account structure is assigned to the Ledger), the organization hierarchy will restrict the financial dimension combinations that you can use in financial transactions.
Advantages:
Organization hierarchies include an effective date feature.
You can link one organization hierarchy to multiple account structures -so that
when you make a change to your organization hierarchy, it will automatically apply to all of the linked accounts structures.
(When instead you have multiple account structures and maintain the financial dimension relationships in each account structure, then each account structure would need to be updated manually.)