How to stop Negative Inventory??

navuser1navuser1 Member Posts: 1,329
Hi All,

Is there any setup in Navision3.7 to stop the transactions which are going to create a negative inventory?
Now or Never

Comments

  • DeepDeep Member Posts: 569
    No standard code. You have to make it.
    Regards,

    Deep
    India
  • navuser1navuser1 Member Posts: 1,329
    Deep wrote:
    No standard code. You have to make it.

    No Standard code in any version???
    Now or Never
  • DeepDeep Member Posts: 569
    No.
    Regards,

    Deep
    India
  • bbrownbbrown Member Posts: 3,268
    navuser1 wrote:
    Hi All,

    Is there any setup in Navision3.7 to stop the transactions which are going to create a negative inventory?

    Use "Lot Tracking" on all items. The systems does not allow "Lot Tracked" items to go negative. You may need to re-think some of the business process to support this change.
    There are no bugs - only undocumented features.
  • navuser1navuser1 Member Posts: 1,329
    ok...

    If I want to put my code then where is write place in Codeunit 22 to check the same.

    In which function of codeunit 22 I use to write my code.
    Now or Never
  • matttraxmatttrax Member Posts: 2,309
    You should probably have an experienced developer do it. You could easily break something.

    That said, if you are the only one who can do it, there is a function in C22 called InsertItemLedgEntry. Be careful. :)
  • ara3nara3n Member Posts: 9,256
    Hello I've done this for many clients as Mattrax mentioned it's in CU 22 function InsertItemLedgEntry.

    The function already does not allow negative inventory for consumption entries.

    IF (((ItemLedgEntry."Entry Type" IN
          [ItemLedgEntry."Entry Type"::"Negative Adjmt.",
          ItemLedgEntry."Entry Type"::Consumption]) AND
          ("Source Type" = "Source Type"::Item)) OR
          (ItemLedgEntry."Entry Type" = ItemLedgEntry."Entry Type"::Transfer)) AND
          (ItemLedgEntry.Quantity < 0)
        THEN
          ERROR(Text005,ItemLedgEntry."Item No.");
    

    text005 is 'Item %1 is not on inventory.'

    You add your own code below it.
    //Mod Start
    if   (ItemLedgEntry.Quantity < 0)  THEN
          ERROR(Text005,ItemLedgEntry."Item No.");
    
    //Mod End[/code]
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • navuser1navuser1 Member Posts: 1,329
    edited 2008-04-29
    fine..

    I have choosen the right function.
    And my code is


    InvtSetup.GET;
    Item.GET(ItemLedgEntry."Item No.");
    Item.SETFILTER("Date Filter",'..%1', ItemJnlLine."Posting date");
    Item.SETFILTER("Location Filter",'%1',ItemLedgEntry."Location Code");
    Item.CALCFIELDS("Net Change");
    IF NOT InvtSetup."Allow Neg. Invt." THEN
    IF (Item."Net Change" + ItemLedgEntry.Quantity) < 0 THEN
    ERROR(Text005A,Item."No.",ItemJnlLine."Posting Date");


    Text005A =
    The quantity in the Inventory is not sufficient to cover net change in the inventory
    for Item No. %1 on date %2.';
    Now or Never
  • ara3nara3n Member Posts: 9,256
    I wouldn't do it this way. Just follow the code example I've written above.
    One problem with your code is, what they are already negative on inventory?
    They will get the error no matter what.
    //Mod Start
    IF NOT InvtSetup."Allow Neg. Invt." THEN 
      if   (ItemLedgEntry.Quantity < 0)  THEN
           ERROR(Text005,ItemLedgEntry."Item No."); 
    //Mod End
    

    Plus your code is slow. You are doing calculating a flow field for every entry.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Alex_ChowAlex_Chow Member Posts: 5,063
    navuser1 wrote:
    Hi All,

    Is there any setup in Navision3.7 to stop the transactions which are going to create a negative inventory?

    Out of the box, you can enable warehouse management. This will prevent inventory from going negative.

    Search the forum, there are a TON of discussions on this.
  • navuser1navuser1 Member Posts: 1,329
    Thanks to Alex and Ara3n.
    Now or Never
  • i4tosti4tost Member Posts: 208
    As i know you can use bins (bin mandatory) and you will not be allowed to go negative
  • navuser1navuser1 Member Posts: 1,329
    ara3n wrote:
    Hello I've done this for many clients as Mattrax mentioned it's in CU 22 function InsertItemLedgEntry.

    The function already does not allow negative inventory for consumption entries.

    IF (((ItemLedgEntry."Entry Type" IN
          [ItemLedgEntry."Entry Type"::"Negative Adjmt.",
          ItemLedgEntry."Entry Type"::Consumption]) AND
          ("Source Type" = "Source Type"::Item)) OR
          (ItemLedgEntry."Entry Type" = ItemLedgEntry."Entry Type"::Transfer)) AND
          (ItemLedgEntry.Quantity < 0)
        THEN
          ERROR(Text005,ItemLedgEntry."Item No.");
    

    text005 is 'Item %1 is not on inventory.'

    You add your own code below it.
    //Mod Start
    if   (ItemLedgEntry.Quantity < 0)  THEN
          ERROR(Text005,ItemLedgEntry."Item No.");
    
    //Mod End[/code]
    Now or Never
Sign In or Register to comment.