How to see why you are getting CONSISTENCY Error

2

Comments

  • David_SingletonDavid_Singleton Member Posts: 5,479
    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?

    Thanks,

    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 Member Posts: 188
    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 Member Posts: 9,256
    I'm glad it helped. :)
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Alex_ChowAlex_Chow Member Posts: 5,063
    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 Member Posts: 96
    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 Member Posts: 9,256
    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);
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • yekedeyekede Member Posts: 96
    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 Member Posts: 9,256
    could you tell a little about what your process does and how you do it?
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • yekedeyekede Member Posts: 96
    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 Member Posts: 185
    Very helpfull. Thanks a lot.
  • ara3nara3n Member Posts: 9,256
    You are welcome.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • vijay_gvijay_g Member Posts: 884
    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 Member Posts: 9,256
    You are welcome. I dreaded consistency errors at the beginning as well. And this does help a lot.

    Who are "maximum guys"?
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • vijay_gvijay_g Member Posts: 884
    Some personal experience:
    The majority of my friends maximum are..........
  • southindiansouthindian Member Posts: 247
    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 Member Posts: 9,256
    you'll need to implement the tool and see the GL lines it creates and see why they are out of balance.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • rmv_RUrmv_RU Member Posts: 119
    This is good trick :). I have implemented Navigate PrePost to verify results of posting without any changes made in DB.
    Looking for part-time work.
    Nav, T-SQL.
  • ara3nara3n Member Posts: 9,256
    yep. I have used it for a customer who wanted to see the GL entries before posting a statement.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • RikarddoRikarddo Member Posts: 80
    Hello,

    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 Member Posts: 5,504
    First you have to import "Single Instance CU" Codeunit which ar3n has given
    Insertgl is a function in that code unit..
  • RikarddoRikarddo Member Posts: 80
    Thanks for the help.

    Now it says i dont have the permission to write in CU 12 :S
  • ara3nara3n Member Posts: 9,256
    You need developer license to compile CU 12. with the changes.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • ponury20ponury20 Member Posts: 11
    @ara3n

    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 Member Posts: 9,256
    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.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • ponury20ponury20 Member Posts: 11
    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 Member Posts: 9,256
    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.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • mohrizkimaulanamohrizkimaulana Member Posts: 9
    what if inconsistency error happen in NAV 2015 or later?
    could you give me an advice how to find the error.

    Thanks
  • davmac1davmac1 Member Posts: 1,283
    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.
  • aureliusm_deaureliusm_de Member Posts: 1
    Pure gold even after 10 years!

    Still works in NAV 2015, just need to change Form to Page and instead of FinishCodeunit() make changes in FinishPosting()
Sign In or Register to comment.