How to close a PO using 4GL code in Sage X3V12 (Sage Enterprise Management)?

In Sage X3 enterprise management, a user can manually close a Purchase order (PO) by clicking the “close order” button on the Purchase order screen. This process can be automated so that X3 users do not have to perform this manual task, freeing up their time for more value-added work processes. To achieve this, we need to use the 4GL code to create a customization on the PO screen. This can be performed by using a standard subprogram from a standard script. Let us suppose we need to close the PO shown in screenshot #1 below. We can see that the status of closed field is “No” which indicates PO is open.

Screenshot #1

There is standard subprogram available under TRTACHDIV1 processing file which can be used to close the PO. Calling this function from specific processing file we can close the PO, as shown in the screenshot #2 below:


Here is the meaning of each parameter values:

  • WPOHNUM: Purchase order number
  • WMSGFLG: An Integer value indicating an error message
  • 0: No error Message
  • 1: error on screen (Call ERROR)
  • 3: Message in trace
  • WRET: (Return Code): It contains an integer value.
Screenshot #2

We can see that after running the above code, the record which we used will be closed. The status of the closed field is “Yes” in the screenshot below, indicating that the PO is closed, as shown in the screenshot #3.

screenshot #3

In this way we can close the PO using 4GL code in Sage X3V12. Thus, this blog helps us in understanding how to use the 4GL code to create a customization on the PO screen on the Sage ERP system.

About Us-

GerminIT – Recognised for its X3 implementation and customization the world over, GerminIT is one of the oldest Sage X3 (a Sage Business Cloud Solution) development and implementation enablers and a one-stop solution provider for Sage X3 organizational needs. With a proven track record of X3 development and implementation solutions for clients across the US, UK, Middle East, Australia, Asia, and Africa, we bring complete end-to-end assistance for data migration, system integrations, technical consultations, implementation competence, third-party add-on development, and product customizations.  

With GerminIT your business will be supported with the best-in-class Sage X3 customization and development services, integrated applications such as Shipping System | eCommerce | Business Intelligence | POS | WMS | Payment Gateway, and mobile add-ons solutions. GerminIT caters to a wide range of Sage X3 offerings. Currently, we provide end-to-end support with Sage X3 implementation and customization solutions for Sage business partners, Sage PSG, and end-users worldwide.  


Cloud ERP Consultation In India


Leave a Reply

Your email address will not be published. Required fields are marked *