Error Posting SalesOrder to Invoice

selece28selece28 Member Posts: 316
Hi All,
I have some problems that i can resolve.
When i'm going to post some SO(sales order) it shows this error message
" Amount 1,85628 needs to be rounded in Gen. Journal Line Journal Template Name='',Journal Batch Name='',Line No.='0'. "
Did anyone knows how to fix this?
Please help me

Thanks in advance
______________

Regards,
Steven

Comments

  • krikikriki Member, Moderator Posts: 9,110
    This seems like a localization or customization problem.
    Use the debugger for tracking the problem.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • David_SingletonDavid_Singleton Member Posts: 5,479
    Unfortunately this will be hard to find with the debugger. The reason is that the Bug that you have written is probably somewhere in either codeunit 80 or Codeunit 22. It looks like some modification that calculates some unit price or cost as a function of the total amount. But the testing is done in CU 12 quite a while after. And with the Navision debugger its not possible to go backwards.

    I think you are going to have to find some point where you divide some amounts, and forgot to round them before you enter them into the Amount field in General Journal Line.
    David Singleton
  • selece28selece28 Member Posts: 316
    I already debug it and haven't find it until now
    I'm curious 'bout the " Gen. Journal Line Journal Template Name='',Journal Batch Name='',Line No.='0'. "
    All of them are empty, is it really because the rounding? Or is it possible there's an error when inserting those line?

    I'm still debugging until now :(

    Thanks in advance
    ______________

    Regards,
    Steven
  • Miklos_HollenderMiklos_Hollender Member Posts: 1,598
    Those journal lines aren't inserted but posted on the fly. So it's normal.

    In CU80 try to MESSAGE or ERROR out (with FORMAT) the values that are put into the journal (search for GenJnlLine). When you find a wrong one you can try to track it back from there.
  • David_SingletonDavid_Singleton Member Posts: 5,479
    selece28 wrote:
    I already debug it and haven't find it until now
    I'm curious 'bout the " Gen. Journal Line Journal Template Name='',Journal Batch Name='',Line No.='0'. "
    All of them are empty, is it really because the rounding? Or is it possible there's an error when inserting those line?

    I'm still debugging until now :(

    Thanks in advance

    better is to find the command

    GenJnlPostLine
    and immediately before it place this:
      IF "Currency Code" = '' THEN
        Currency.InitRoundingPrecision;
      END ELSE
        Currency.GET("Currency Code")
        IF Amount <> ROUND(Amount,Currency."Amount Rounding Precision") THEN
      ERROR('Amount %1 must be rounded to %2,
        Amount, ROUND(Amount,Currency."Amount Rounding Precision"));
    
    David Singleton
  • selece28selece28 Member Posts: 316
    Hi All,
    I've found it, and yes the problem is on CodeUnit 80.
    Thanks, i use the ROUND() function and the posting is working now

    But theres something i want to know, whats the different between rounding value 0,01 and 0,00? Can anyone explain me?

    Thanks again to all, for helping me solve this problem,
    You guys are the best :)
    ______________

    Regards,
    Steven
  • David_SingletonDavid_Singleton Member Posts: 5,479
    selece28 wrote:
    Hi All,
    I've found it, and yes the problem is on CodeUnit 80.
    Thanks, i use the ROUND() function and the posting is working now

    But theres something i want to know, whats the different between rounding value 0,01 and 0,00? Can anyone explain me?

    Thanks again to all, for helping me solve this problem,
    You guys are the best :)

    First of all and most important.

    DO NOT use the code:

    Amount := ROUND(Amount,0.01) in this case. The code I posted was to find the error, once found, use this code:
    IF "Currency Code" = '' THEN
        Currency.InitRoundingPrecision;
      END ELSE
        Currency.GET("Currency Code")
    Amount := ROUND(Amount,Currency."Amount Rounding Precision");
    

    This will then round to the default rounding for your currency.

    ROUNd(amount,0.01) says to round to the nearest 0.01, you could also use 0.05 or anything else.

    Round(amount0.00) does nothing, since the nearest 0 is the same.

    Think in terms of Amount mod 0.01 and Amount mod 0.00.
    David Singleton
  • DigiTecKidDigiTecKid Member Posts: 46
    David,
    Thanks for pointing me in the right direction. It turned what could have taken hours of debugging into about 30 minutes. Some other solution center did a mod that calculated amounts & pushed the unrounded data into the Gen. Journal Line record being posted. Correctly rounded everything works as designed. :)
  • DenSterDenSter Member Posts: 8,305
    I love it when these old posts pop years after and are still relevant. Thanks for following up :thumbsup:
  • David_SingletonDavid_Singleton Member Posts: 5,479
    =D>
    David Singleton
Sign In or Register to comment.