Error message when you open a purchase order in the Purchase Order Entry window in Microsoft Dynamics GP: "Unhandled script exception: Value of range"

Applies to: Dynamics GP 2010Dynamics GP 2013

SYMPTOMS

When you open a purchase order in the Purchase Order Entry window in Microsoft Dynamics GP, you receive the following error message:

Unhandled script exception:
Value of range.

EXCEPTION_CLASS_SCRIPT_OUT_OF_RANGE
SCRIPT_CMD_SELECTED

 

CAUSE

This problem occurs if the POTYPE value in either of the following tables is set to 0:

• The POP10100 table
• The POP10110 table

Microsoft Dynamics GP cannot read this value because the only possible POTYPE values are as follows:

• 1 = Standard
• 2 = Drop-ship
• 3 = Blanket
• 4 = Drop-ship blanket


     

Note This problem typically occurs if the purchase order is imported into Microsoft Dynamics GP.

RESOLUTION

To resolve this problem, update the POTYPE value to a valid number. To do this, follow these steps.

Note Before you follow the instructions in this article, make sure that you have a complete backup copy of the database that you can restore if a problem occurs.
1. Run the following statements against the company database in SQL Query Analyzer. To start SQL Query Analyzer, click Start , point to Programs , point to Microsoft SQL Server , and then click Query Analyzer .
/*PO Header - work*/ Select * from POP10100 where POTYPE = 0 /*PO Line - work */ Select * from POP10110 where POTYPE = 0
Note This script flags all the purchase orders that have a POTYPE value of 0.
2. Run the following statements against the company database in SQL Query Analyzer.
/*PO Header - work*/ Select * from POP10100 where PONUMBER = 'purchase order number' /*PO Line - work*/ Select * from POP10110 where PONUMBER = 'purchase order number'

Notes

• This script flags the specific purchase order number that is experiencing the problem.
• Replace purchase order number with the purchase order number that is experiencing the problem.
• Note the DEX_ROW_ID value that is returned for the POP10100 table. This value will be used in step 3.



     
3. If the POTYPE value is set to zero, update the POTYPE value. To do this, run the following statements against the company database in SQL Query Analyzer.
Update POP10100 set POTYPE = POTYPE value where DEX_ROW_ID = DEX_ROW_ID number

Notes

• If the POTYPE value is not set to zero, you can copy the POTYPE value from the Purchase Order Line table (POP10110). Make sure that you set the POTYPE value to the correct value. The possible values are listed in the "Cause" section. You may receive more error messages if the POTYPE values in the POP10100 table and in the POP10110 table do not match.
• Replace DEX_ROW_ID number with the appropriate DEX_ROW_ID value that was returned in step 2.



     
4. Log on to Microsoft Dynamics GP by using the sa user account. Then, perform the Check Links procedure on the purchasing transactions in Purchasing in Microsoft Dynamics GP. To do this, follow these steps:
a. Click File , point to Maintenance , and then click Check Links .
b. In the Series list, click Purchasing .
c. Click Purchasing Transactions , click Insert , and then click OK .
d. Click to select the Screen check box, and then click OK .
e. Verify that you do not receive the error message that is shown in the "Symptoms" section.