Users can close work orders even though there are purchase orders associated with them.
1. Create a new PO and enter a vendor.
2. Go to PO Lines tab.
Click "New Row" to create a new POLINE.
Populate all the required fields.
Click the arrow next to the "Work Order" field.
Click the "Select Value" button.
Select any work order from the list.
Save the record.
3. Hyper-link to the work order in the Work Order Tracking application.
4. Try to change the status of the work order to CLOSE and receive the system message: "BMXAA4577W - Open purchase orders exist here.":
Receive another message: "Please wait..."
The work order is then closed:
NOTE: Clicking "Close" on the message will close the work order, however clicking "OK" on the message "BMXAA4577W - Open purchase orders exist here" should NOT close the work order.
Diagnosing The Problem
Resolving The Problem
It is possible to use an automation script to prevent user from closing work orders with open POs.
1. Go to the Database Configuration and from the "Select Action" menu, create a new message for the workorder group:
2. Go to System Configuration > Platform Configuration > Automation Scripts application.
From the "Select Action" menu > Create > Script with Object Launch Point.
Create an object launch point under "Select Action" menu:
3. Launch Point = XWOLAUNCH
Object = WORKORDER
Object Event Condition = status in ('CLOSE')
Select "Add and Update" for the Events:
4. Click "Next":
script = VALWOSTATUS
variable = openpo
type = IN
launch point attribute = POLINE.PO[status not in ('CLOSE','CANCEL')].PONUM
Enter the source code:
if openpo is not None and len(openpo) > 0:
errorgroup = 'workorder'
errorkey = 'xopenpoexists'
errorgroup and errorkey needs to be indented. Below is what the script looks like on the screen:
Change the status of the automation script to ACTIVE.
1. Try to close a work order with open POs.
Receive the message:
BMXAA8997E - Open purchase orders exist here or at some point below in the hierarchy. The status of this Work Order will not be changed to Closed.
Receive message: BMXZZ0001E - Work Order can not be closed.Please close all associated Purchase Orders.
Click OK on the status dialog box.
Receive system message again:
BMXZZ0001E - Work Order can not be closed.Please close all associated Purchase Orders.
This error message does not go away and users would not be allowed to close work orders with open POs:
17 June 2018