How to see why you are getting CONSISTENCY Error



  • David_SingletonDavid_Singleton Posts: 5,367Member
    jaustin wrote:
    I'm attempting to create the code unit that ara3n suggested but am not sure where/how some of this code can be put into the code unit (designer mode). Example: How or where do you enter the "TempGLEntry@1000000000 : TEMPORARY Record 17;" ??? I don't see a way to enter this in the designer.

    I've seen other postings with code displayed in the way that ara3n has put it in his posting. How do you get a code unit to display all of the properties and code the way that has been posted here? Can this code be imported some how, as is?


    You copy the text and paste it into a text file with a TXT extension, and then go to Object designer and import that file (option text file).
    David Singleton
  • headley27headley27 Posts: 232Member
    Brilliant ara3n!!

    This was so easy to implement and helped me find the issue very very quickly.

    Thanks for sharing this code. =D> =D> =D>
  • ara3nara3n Posts: 9,147Member
    I'm glad it helped. :)
  • Alex_ChowAlex_Chow Posts: 5,051Member
    davmac1 wrote:
    Yes I did. I still had the error. I then tried posting the invoice without selecting the shipment and invoice problem and that posted and it also adjusted the outstanding amount to match the amount including tax on the sales line.

    Yes, this is a problem we've also encountered. The problem was with the rounding when posting a credit memo. We were able to fix it by applying the same ROUND function to the credit side.
  • yekedeyekede Posts: 96Member
    Hi all,
    I'm getting this error and i used this tip because i thought it was due to decimal amounts not balancing. But when i run the singleCU for the second time it shows form General Ledger Entries with no entries, the form is empty. I also tried other tips posting to a journal and all amounts balanced =0 in the journal. So in this case what can be the cause for this error? Please can someone direct me to tha source of this error?
    I describe what i'm trying to achieve: post value from a document by creating journal lines,call codeunit 12 with journal line record etc.
  • ara3nara3n Posts: 9,147Member
    How did you implement this code?

    Did you copy and past the object into a text file and then import it? (make sure the CU doesn't already exists);
  • yekedeyekede Posts: 96Member
    Hi i copy the code from your post and paste into a txt file, save and import, compile, add code to codeunit 12 and compile. then run CU 50000 once and run my process, then run CU 50000 second time and it shows me the empty G/L Entry form. Thanks for your reply.
  • ara3nara3n Posts: 9,147Member
    could you tell a little about what your process does and how you do it?
  • yekedeyekede Posts: 96Member
    Hi, thanks for reply
    I'm trying to implement a functionnality that create payslips for employees and when i post payslip, it create posted documents and also create ledger entries according to amounts on the payslip, and also employee entries.To achieve this i create journal line from information on payslip document then i call the runwithcheck function of genjnlpostline CU. this works fine except for sometimes when the amounts are decimal, it throws inconsistent error. so i've tried as much as possible to round the amounts before posting, 90% it posts fine but a few times i still get the problem described above ](*,) .
  • xavigepexavigepe Posts: 185Member
    Very helpfull. Thanks a lot.
  • ara3nara3n Posts: 9,147Member
    You are welcome.
  • vijay_gvijay_g Posts: 835Member
    thanks a lot really very helpful....
    before this i was so far to solve inconsistency even felt unsecure(technically) to go through on it now happy when it comes
    to me. unfotunatly maximum guys not familiar with this post because of they are not in touch with this forum..
  • ara3nara3n Posts: 9,147Member
    You are welcome. I dreaded consistency errors at the beginning as well. And this does help a lot.

    Who are "maximum guys"?
  • vijay_gvijay_g Posts: 835Member
    Some personal experience:
    The majority of my friends maximum are..........
  • southindiansouthindian Posts: 247Member
    Hello all,

    Frist of all I would thank Mr. aran for giving this wonderful tool.
    Am getting the same error While posting the Purchase Invoice.After going through all the Replies posted here,
    My understanding is "The problem is due to Rounding precesion of Decimal Amount". is my understanding is right .
    kindly requesting you all clarify whether my understanding is right , if not kindly guide me.
  • ara3nara3n Posts: 9,147Member
    you'll need to implement the tool and see the GL lines it creates and see why they are out of balance.
  • rmv_RUrmv_RU Posts: 108Member
    This is good trick :). I have implemented Navigate PrePost to verify results of posting without any changes made in DB.
    NAV and T-SQL Developer.
    Have performance issues?
    Contact me.
  • ara3nara3n Posts: 9,147Member
    yep. I have used it for a customer who wanted to see the GL entries before posting a statement.
  • RikarddoRikarddo Posts: 3Member

    I'm new at this so help me.
    How i define variables in this code "SingleCU.InsertGL(GLEntry);"

    SingleCU as codeunit right? and what about Insertgl?
  • mohana_cse06mohana_cse06 Posts: 4,906Member
    First you have to import "Single Instance CU" Codeunit which ar3n has given
    Insertgl is a function in that code unit..
  • RikarddoRikarddo Posts: 3Member
    Thanks for the help.

    Now it says i dont have the permission to write in CU 12 :S
  • ara3nara3n Posts: 9,147Member
    You need developer license to compile CU 12. with the changes.
  • ponury20ponury20 Posts: 11Member

    Hi there. How did you rollback transaction of other tables in posting routine? I can manage to not to insert to G/L any data (just comment one line) but what with other tables? And the document? Did you changed the code looking for every INSERT statement in posting code and commented it? I know I could do it, but I am thinking of something more simple, like do ERROR('') at the end of whole proces (but this way I cannot keep data in temp table of codeunit). Could you leave some tips? Thanks in advance.
  • ara3nara3n Posts: 9,147Member
    Yes at the end you simply Error('').

    Anything you have inserted into your TempGLEntry in your single instance codeunit stays in there.

    That is how in my example I'm showing the glentry after a consistency error, which is just like any other error.
  • ponury20ponury20 Posts: 11Member
    ara3n wrote:
    Yes at the end you simply Error('').

    Anything you have inserted into your TempGLEntry in your single instance codeunit stays in there.

    That is how in my example I'm showing the glentry after a consistency error, which is just like any other error.

    I do not know how simply get proper result without analasing whole code. In my case, when I add an ERROR at the end of purch-post codeunit, the are lots of COMMIT before, which means I realy post the document with all dimensions created and so on. If I add an ERROR after the SingleCU.InsertGL I get only first entry created by the system (there are always minimum 2).
    Is there a simple soultion or I need to insert a lot of IF statements during whole posting routine?

    Ps. sorry for my english skills :)
  • ara3nara3n Posts: 9,147Member
    if you want to see all the GL accounts for PO that you are posting, you would add the error in CU 90 before the last commit. If there other commits in there, you need to by pass it.
  • mohrizkimaulanamohrizkimaulana Posts: 9Member
    what if inconsistency error happen in NAV 2015 or later?
    could you give me an advice how to find the error.

  • davmac1davmac1 Posts: 1,193Member
    you can always run the debugger and breakpoint it at the place where it write the G/L Entries to the permanent file and look at the entries being created - typically it is either a rounding problem or a balancing entry that does not balance.
Sign In or Register to comment.