How to ‘Close PO’ programmatically using 4GL Script

By | December 29, 2020

In Sage X3, User have option to close Purchase order manually by using “close order” button on Purchase order screen. But one of our client has requested to automate this process on certain event so that user doesn’t have to take of this manually. To achieve this we have come up with some customization on PO screen where we did the 4GL code. Using the standard subprogram from standard script, we able to do it successfully. Lets look at the subprogram code.

New stuff: Restriction on Purchase Invoice Creation

Syntax:

Call TRTPOHCLE (WPOHNUM, WMSGFLG, WRET) From TRTACHDIV1

Here is the meaning of each parameter value,

WPOHNUM: Purchase order number
WMSGFLG: It is Integer value which indicates error message
0: No error Message
1: error on screen (Call ERROR)
2: GMESSAGE+GERROR
3: Message in trace
WRET: (Return Code) It Contains an integer value.

By calling above subprogram we can close the Purchase order.

Through above syntax we can close the purchase order by calling TRTPOHCLE subprogram from standard script with proper parameters.

Example:

Here we have created one Purchase order as shown in below screenshot which is showing closed order status “No” means PO is not closed yet.

Purchase Order screen- Closed Status
Purchase Order screen- Closed Status “No”

Now, call the Subprogram with appropriate parameter as mentioned in below script screenshot to close PO.

Script
Script

After execution of script, Purchase order got closed as shown in below screenshot.

Purchase Order screen- Closed Status
Purchase Order screen- Closed Status “Yes”

In this way, any programmer who knows the 4GL scripting can do this customization easily.

About Us

Greytrix – a globally recognized and one of the oldest Sage Development Partners is a one-stop solution provider for Sage ERP and Sage CRM organizational needs. Being acknowledged and rewarded for multi-man years of experience and expertise, we bring complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third-party add-on development, and implementation competence.

Greytrix has some unique integration solutions developed for Sage CRM with Sage ERPs namely Sage X3Sage IntacctSage 100Sage 500, and Sage 300. We also offer best-in-class Sage ERP and Sage CRM customization and development services to Business Partners, End Users, and Sage PSG worldwide. Greytrix helps in the migration of Sage CRM from Salesforce | ACT! | SalesLogix | Goldmine | Sugar CRM | Maximizer. Our Sage CRM Product Suite includes addons like  Greytrix Business Manager, Sage CRM Project Manager, Sage CRM Resource Planner, Sage CRM Contract Manager, Sage CRM Event Manager, Sage CRM Budget Planner, Gmail Integration, Sage CRM Mobile Service Signature, Sage CRM CTI Framework.

Greytrix is a recognized Sage Champion Partner for GUMU™ Sage X3 – Sage CRM integration listed on Sage Marketplace and Sage CRM – Sage Intacct integration listed on Sage Intacct Marketplace. The GUMU™ Cloud framework by Greytrix forms the backbone of cloud integrations that are managed in real-time for the processing and execution of application programs at the click of a button.

For more information on our integration solutions, please contact us at sage@greytrix.com. We will be glad to assist you.