Decimal data type over flow error

dilladilla Member Posts: 31
Hello guys,

DB in question is NAV 2009 SP1 (classic version).

I am currently running the inventory adjustment batchjob report on the clients DB, and for one specific item during the "actual cost" calculation in table 5820 - "Cost Element Buffer" the value is computed as :
"141,502,760,062,080,928,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000" - (NO decimal points)

Now,evidently the "Actual cost" field which is a decimal data type cannot hold such a huge decimal type. The system is throwing the Decimal overflow error.

ERROR: "An Integer is too large.
141,502,760,062,080,928,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000"

I am trying to dubug the "Inventory Adjustment" codeunit to find the reason for this computation. The costing method used is "Average". In the mean time just wanted the experts out there to give me any kind of suggestions to overcome or workaround this issue.

NOTE: The batch job is working fine for all the items in the Db (1500 odd items except for this)

Regards,
Prash

Comments

  • kinekine Member Posts: 12,562
    It looks like some problems in entries...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • MBergerMBerger Member Posts: 413
    i had something similar once. All the quantites of some entries were added, and were supposed to be zero, but they turned out to be 0.0000000000000001. if you then divide the total value by that fraction, you get crazy amounts like the original poster mentions. ( one box of strawberries had a price of €15.000.000.000.000,00 ;) )

    i think it's caused by the fact that decimals can't be stored with complete accuracy, and that somewhere along the line you DO get a tiny discrepancy.

    a common fix for this is look up where the division is made. It wil probably have a check right before it to see if the value divided by isn't zero. Just before that, round the value to something that is a bit more sane, but still has quit a few decimals ( to avoid errors due to the rounding )
Sign In or Register to comment.