You just use the No. Series Setup and then use No Series management to retrieve the next No. Check the standard code for Sales Order, Customer, Item. You need to add the code in the OnInsert trigger to retrieve the value.
ex:
NoSeriesMgt.GetNextNo('Order Nos.", WorkDate, true); Where Order Nos is the setup field, for that review Sales & Receivables Setup... for the Number Series to Setup.