The assignment of G/L accounts always depends on the chart of accounts. A chart of accounts is assigned to a company code in Customizing for Financial Accounting (FI).
G/L accounts can be assigned per valuation area. When you execute a business process, the valuation area is part of it. In Customizing, you can see whether the valuation area is to be the company code or the plant. This setting must be made before materials are created and Inventory Management transactions are entered.
If a material is subject to split valuation, you can valuate various stocks of the same material differently and manage them in different accounts.

