account distribution (ledger account)

How to create account distribution (ledger account) for each line of the Purchase Order through code?