Closing Purchase Order Using 4GL Code in Sage Enterprise Management (Formerly Sage X3 V11)
Purchase order can be manually closed by using the close button in Purchase order, but in some scenarios, it is not possible to close the purchase order manually. Under such circumstances, we need to call a subprogram from standard.
Following syntax is used to close the Purchase order
Call TRTPOHCLE (WPOHNUM, WMSGFLG, WRET) From TRTACHDIV1
WPOHNUM: Purchase order number
WMSGFLG: It is Integer value which indicates error message
0:- No error Message
1:- error on screen (Call ERROR)
3:-Message in trace
WRET: (Return Code) It Contains an integer value.
By calling above subprogram we can close the Purchase order. (Note: There is always a transaction in Progress when we use this sub-program)
Created a purchase Order
Code for Closing the Purchase Order
After execution of the Code, Purchase Order is closed as shown below.