How to Close Sales Order Lines programmatically using 4GL Script in Sage X3


If we want to close the sales order lines using 4GL code in SEM (Sage X3).

Following syntax is used to call the subprogram to close the Sales order lines.



WSOHNUM: It is a character variable which contains Sales order number

WSOPLIN : It is Integer value which indicates Sales order Line number

WSOQSEQ : It Contains an integer value. This indicates sequence number


WCCLREN : It Contains an character value. Which is reason for Closing


By calling above subprogram we can close the Sales order lines.

(Note: There is always a transaction in Progress when we use this sub-program)


Create a sales order before execution of the code


Closed Sales order is shown below.

Code for Closing SOH lines.png

After Execution of code the order line will be closed based on the criteria as shown in below.

If all lines get closed then Sales order will be closed automatically which is being handled by standard process.


Transforming businesses since 2009

For over a decade, Panni has helped companies transform their businesses to lead, innovate and be profitable. With the right combination of technology and experienced developers and consultants, we help companies with Change Management to achieve the organizational objectives. We believe in long-term relationships with our clients and provide top-notch support with fast turnaround times.

Looking for ERP advice?