Skip to main content

Notifications

Microsoft Dynamics GP (Archived)

Running the Historical Stock Status Report - Unhandled Script Exception

Posted on by Microsoft Employee

Hello:

A GP 2015 client is getting the error message shown below, upon running the Historical Stock Status report as of 12/31/2017 and for only one G/L account in particular.

We have run through the steps in the article shown below but to no effect.

Has anyone found a remedy for this issue?

Thank you!

John

Unhandled Script exception:

SCRIPTS - data area

EXCEPTION_CLASS_SCRIPT_DIVIDE_BY_ZERO

SCRIPT_CMD_DIV

 

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.

 

 

Cause

This problem is typically caused by some type of data corruption in the IV30300 table. Most common are:

 

    1. Specific document types in the IV30300 are missing a transaction source.

 

    1. Specific document types with invalid values of 0 in the DECPLCUR and DECPLQTY fields.

 

 

Cause 1

Specific document types in the IV30300 are missing a transaction source. Each document that is posted through Microsoft Dynamics GP should have a transaction source associated with it. Due to a posting interruptions or an integration/customization issues, this value may be missing. Use the script below to identify any documents that have a blank transaction source. All of these document types listed should have a transaction source. If they do not have a transaction source the records need to be fixed or removed.

 

1. Run the following statement against the company database in SQL Server Management Studio to identify transactions with this condition:

 

SELECT * FROM IV30300 WHERE TRXSORCE  = '' and  doctype in (1, 2, 3, 4, 5, 6, 7) 

    1. If any documents get returned using the script above, run a select statement on the document number listed against the following Inventory tables (IV30300, SEE30303, IV10200, IV10201) and investigate where the corruption is or if it’s only in the IV30300. It might be a corrupt record or it might be partially updated. Each line returned will have to be investigated and determined how to proceed with fixing.  If it’s something that can be deleted, we suggest deleting based on DEX_ROW_ID.

Example:

DELETE IV30300 WHERE DEX_ROW_ID = XXX 

 

Cause 2

Specific document types with invalid values of 0 in the DECPLCUR and DECPLQTY fields.


Note The DECPLCUR field refers to the captured currency decimal place and the DECPLQTY field refers to the captured quantity decimal place for the item. On all valid transactions this should be populated with a value.

    1. Run the following statement against the company database in SQL Server Management Studio to identify transactions with this condition:

Select * from IV30300 where (DECPLQTY = 0 or DECPLCUR = 0) and  doctype in (1, 2, 3, 4, 5, 6, 7)           

If you find documents with 0 decimal places, these need to be investigated. Correct the corrupted transaction by using SQL Query Analyzer by updating the fields to the appropriate value.

Decimal place values in the IV30300 are as follows:

Value in table

Value shows in GP (Actual value)

1

0

2

1

3

2

4

3

5

4

6

5

Example update statement below:

UPDATE IV30300 set DECPLQTY = 3 WHERE DEX_ROW_ID = XXX

If the results are all old transactions and you prefer to Remove history for the corrupted transactions, you can remove history by pointing to Tools on the Microsoft Dynamics GP menu, point to Utilities, point to Inventory, and then click Remove Transaction History and removing the appropriate document number(s).

 

 

 

 

*This post is locked for comments

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Running the Historical Stock Status Report - Unhandled Script Exception

    Good Morning:

    The issue was that two records in the IV30300 table had the “Quantity in the Base Unit of Measure” field equal to 0, while all others has this field equal to 1.

    Once the client QTYBSUOM equal to 1, the error went away.

    John

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans