Adjust Cost - Item Entries [Error Division By Zero 0/0]

xchild
Member Posts: 22
I am getting a "Division by Zero" error message when trying to run the Adjust Cost - Item Entries in Navision 4.0.
The error occurs in Inventory Adjustment codenit number 5895 within the function CalcCostPerUnit.
The error occurs after the second IF statement and I don't really know what values the program is using to create entries in Cost Element Buffer table.
The error occurs in Inventory Adjustment codenit number 5895 within the function CalcCostPerUnit.
The error occurs after the second IF statement and I don't really know what values the program is using to create entries in Cost Element Buffer table.
0
Comments
-
Try to import SP1 objects and run adjust cost routine.0
-
I am having the same error, and I'm a little bit tired of having to debug this codeunit in all versions again and again... Importing SP1 objects is not feasible, as there might have been related changes in other objects, like Item Jnl - Post Line etc.
Did anyone debug this error before me, so I might save the effort this time?
Do It Yourself is they key. Standard code might work - your code surely works.0 -
However I only got this error in a testing database, where an Item is set to Standard Costing and the standard cost = 0 so it might not happen in a production database, I hope.
Do It Yourself is they key. Standard code might work - your code surely works.0 -
Shenpen wrote:However I only got this error in a testing database, where an Item is set to Standard Costing and the standard cost = 0 so it might not happen in a production database, I hope.
[-X You know it will happen, 9/10 of good programming is for the exception.
Would it not be wise to debug and IF Value1 <> 0 THEN X := Value2/Value1; ?
:PAnalyst Developer with over 17 years Navision, Contract Status - Busy
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com0 -
No, because I think this is a deeper issue - I would not assume our friends at Vedbaek made so simple errors - and if I apply such a simple fix, some other value might get wrong.
Do It Yourself is they key. Standard code might work - your code surely works.0 -
I know that there were some similar problems in 3.60, solution was to do positive adjustment of one PCS of the item which is source of the problem, run the job and do neg. adjustment of the item back to original quantity. I described the problem somewhere on the former partnerguide site but it is not available anymore and I forgot the details (but there were problem when the system was calculating history of the stock and in some point the system calculated that there is 0 stock and tried to divide the amount with this quantity...)0
-
still getting the same error in NAV5SP1
CalcCostPerUnit(VAR OutbndValueEntry : Record "Value Entry";OutbndCostElementBuf : Record "Cost Element Buffer";ItemLedgEntryQty : DeciMAL... WITH OutbndCostElementBuf DO BEGIN IF (OutbndValueEntry."Cost per Unit" = 0) AND ("Remaining Quantity" <> 0) THEN OutbndValueEntry."Cost per Unit" := "Actual Cost" / (ItemLedgEntryQty - "Remaining Quantity"); IF (OutbndValueEntry."Cost per Unit (ACY)" = 0) AND ("Remaining Quantity" <> 0) THEN OutbndValueEntry."Cost per Unit (ACY)" := "Actual Cost (ACY)" / (ItemLedgEntryQty - "Remaining Quantity"); END;
What if i add in the beginningIF ItemLedgEntryQty - OutbndCostElementBuf."Remaining Quantity" <> 0 THEN
i just wonder if the logic of the code that gives me ItemLedgEntryQty is ok or not. BEcause if it is not then it can lead to wrong results. And if it ok maybe i should assignOutbndValueEntry."Cost per Unit (ACY)" := "Actual Cost (ACY)"
and not leave it 0 ?0 -
I have the same problem in 2009 R2 - when i´m doing a positive adjustment in an Item Journal Line. I´m considering simular code as Eugene but don´t know if this will cause me any other problems.
Anyone tried this?
BR Hawkeye0 -
running into this now on a 2009 system. was there ever any proper resolution to this?
hawkeye and Eugene how did you get past it?0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions