You can delete gl account and chart of account if you do not have any transactional posting in it. You have posting in it then you cannot delete it instead you can block the gl account or mark it for deletion by which further postings will be blocked to it.
How to delete gl account
Use transaction code OBR2 or following path to delete a gl account;
SPRO > Financial accounting > general ledger accounting > GL accounts > Master data > Delete > Delete gl account
When you execute this transaction you will find that you will have option to delete customers, vendors, gl accounts including sample account. You also have option chose deletion of COAs segment or company code segment of a gl master.
Enter the range or gl a/c you want to delete and execute it. We request you to execute this transaction in test run first before doing real run.
How to delete COAs
To delete COA you need to enter transaction code OBY8 or use following path;
SPRO > Financial accounting > general ledger accounting > GL accounts > Master data > Delete > Delete chart of accounts
Enter your chart of account and press enter.
A proposed list displaying the deletion list will be displayed. If your COA cannot be deleted then the same will be displayed here.
Click on the back button once and then click on “delete chart of account” or “shift+f2” to delete COAs.
It will be asking for a transport request. Enter the transport request and press enter.
A message that COA deleted will be displayed.
You can delete gl a/cs while deleting the COA. You cannot delete COA if it is assigned to your company code or referred in a controlling area. If it is in use somewhere then it cannot be deleted.