Sales orders are used throughout the sales process to hold information about the goods or services that a company sells to its customers. Normally, sales orders are created from the user interface, but for the automated processes, sales orders can also be created from the code.
In this recipe, you will learn how to create a sales order from the code. We will use a standard method provided by the application.
Carry out the following steps in order to complete this recipe:
- Add a new
Runnable
class in your project and name itSalesOrderCreate
. Copy and paste the following code in the main method of this class:
static void SalesOrderCreate(Args _args) { NumberSeq numberSeq; SalesTable salesTable; SalesLine salesLine; ttsBegin; numberSeq = NumberSeq::newGetNum( SalesParameters::numRefSalesId()); numberSeq.used(); salesTable.SalesId = numberSeq.num(); ...