Victoria Yudin has a great post up on GL Distributions in Sales Order Processing. Make sure that you give this a look. It can be a big help in understanding how SOP works.
SOP GL Distributions
Sales, Purchasing & InventoryGeneral Ledger & Financials
Archived post from 2008. Dynamics GP and the links it points to have changed since; check current documentation before relying on version-specific steps.