INCONSISTENCY ERROR IN NAVISION

INCONSISTENCY Error in Navision Occur because of the following reason.

Posting invoices writes to the G/L entries and the total must ALWAYS be 0.
Somewhere an amount is written but it has no opposite to make the total 0.
This means that there is a problem with some customization of the code.

This is a trick I use whenever I do try to solve and see why you the db is getting CONSISTENT Error.
I create the following CU.

OBJECT Codeunit 50000 Single Instance CU
{
OBJECT-PROPERTIES
{
Date=10/11/07;
Time=[ 2:50:02 PM];
Modified=Yes;
Version List=MOD01;
}
PROPERTIES
{
SingleInstance=Yes;
OnRun=BEGIN
IF NOT StoreToTemp THEN BEGIN
StoreToTemp := TRUE;
END ELSE
FORM.RUNMODAL(0,TempGLEntry);
END;

}
CODE
{
VAR
TempGLEntry@1000000000 : TEMPORARY Record 17;
StoreToTemp@1000000001 : Boolean;

PROCEDURE InsertGL@1000000000(GLEntry@1000000000 : Record 17);
BEGIN
IF StoreToTemp THEN BEGIN
TempGLEntry := GLEntry;
IF NOT TempGLEntry.INSERT THEN BEGIN
TempGLEntry.DELETEALL;
TempGLEntry.INSERT;
END;
END;
END;

BEGIN
END.
}
}



And in CU 12 I add the following Code in function FinishCodeunit

FinishCodeunit()
WITH GenJnlLine DO BEGIN
IF GLEntryTmp.FIND('-') THEN BEGIN
REPEAT
GLEntry := GLEntryTmp;
IF GLSetup."Additional Reporting Currency" = '' THEN BEGIN
GLEntry."Additional-Currency Amount" := 0;
GLEntry."Add.-Currency Debit Amount" := 0;
GLEntry."Add.-Currency Credit Amount" := 0;
END;
GLEntry.INSERT;
//MOD01 Start
SingleCU.InsertGL(GLEntry);
//MOD01 End
IF NOT InsertFAAllocDim(GLEntry."Entry No.") THEN


Once you've made the changes. You run the SinleInstanceCU Once.
Then do what ever you do to get the consistency error.
Then Run the SingleInstanceCU again.
You'll see a list of GL lines. You will see why the transaction is not balanced.

[disqus][facebook][blogger]

Jubel Thomas

{picture#https://plus.google.com/u/0/photos/116645982191572612106/albums/profile/5718535508567382818} Having 9+ years of Dynamics NAV Experience with Modules like Finance, Sales, Manufacturing, Warehouse, Purchase, Human Resource etc. Also know LS retail, Dynamics AX, Business Intelligence. {facebook#https://www.facebook.com/Navision-Planet-347570178709579/} {twitter#https://twitter.com/NavisionPlanet}

Contact Form

Name

Email *

Message *

Powered by Blogger.