Division By Zero

navuser1navuser1 Member Posts: 1,329
Dear all,

I have created a PO with calculating the Service Tax and try to post it in the Nav 5.0 SP1 HF2 IN version db.

It gives me an error message Division by zero.

CodeUnit 12, Function Name : PostServiceTax


how to solve this issue ?
Now or Never

Comments

  • mohana_cse06mohana_cse06 Member Posts: 5,504
    before calculating check the condition that
    if servicetac ecess amount <> 0 then
    .....
  • DenSterDenSter Member Posts: 8,305
    If that is part of a hotfix, then you need to get in touch with Microsoft and notify them that they have introduced this error, so that they can issue a hotfix to fix this hotfix :mrgreen: .
  • ara3nara3n Member Posts: 9,256
    I think MS and every vertical solution out there should look for all code that has division in code and make sure there is an if statement or code that prevents division by zero.

    This is a simple search for / in all objects.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • jlandeenjlandeen Member Posts: 524
    LOL you think there could be something in the compiler that warns about div by 0?

    would be nice!
    Jeff Landeen - Sr. Consultant
    Epimatic Corp.

    http://www.epimatic.com
  • navuser1navuser1 Member Posts: 1,329
    Dear All,

    The process is as follows :

    First I posted a bank payment entry (advance to vendor) with a check mark in Serv. Tax on Advance payment field in Bank Payment Voucher.

    Thereafter I created a purchase order with that vendor and activate the Applies-to-doc type feild & Applies-to-doc No. feilds.

    During posting the error (Division by Zero) appears.

    Regards
    SB
    Now or Never
  • DenSterDenSter Member Posts: 8,305
    In which case that variable has a zero value, and it blows up, because the code does not take zero value into account. Report this issue to Microsoft and have them address it. What you have told us is that they provided a hotfix that causes a problem, and they would probably appreciate it when you report this issue. Chances are that they already know about it, and they have a fix ready for it.
  • David_SingletonDavid_Singleton Member Posts: 5,479
    jlandeen wrote:
    LOL you think there could be something in the compiler that warns about div by 0?

    would be nice!


    If I do Z := x / y;

    how can the compiler know that the value of y will be zero :-k
    David Singleton
  • DenSterDenSter Member Posts: 8,305
    I think Jeff was joking :mrgreen:
  • David_SingletonDavid_Singleton Member Posts: 5,479
    :oops: yes I think so.
    David Singleton
  • jlandeenjlandeen Member Posts: 524
    Yes I was joking div by zero errors are difficult to account in a compiler and they're normally hammered home in any introductory Computer Science class....but thankfully they're annoying but not too difficult to prevent ;)
    Jeff Landeen - Sr. Consultant
    Epimatic Corp.

    http://www.epimatic.com
Sign In or Register to comment.