A number of things have to be in place to ensure that the sub-analysis is auto populated when entering the stock code:
The Stock Code used must be the Sub-analysis type.
One of the Stock code's Sub-Analysis entries must be flagged as the Default Outbound.
In the Options setting for Sales Orders, select Always Select Default Sub Analysis.
