Base Unit Of Measure error

MathanMathan Member Posts: 55
Hi,

We get an error stating base unit of measure must have a value in item master when posting an created sales order. There is no Base Unit of measure set for that Item. But some how they have posted purchased receipt, Now it has 4 qty in the inventory. When we tried to post a negative journal for that item, Even then we get this error again. Is there any way to set the Base unit of measure for that Item. Any help would be appreciated.

Thanks,
Mathan

Best Answers

  • DenSterDenSter Member Posts: 8,307
    Answer ✓
    If you are having that issue in production, then you have a serious problem with someone accessing your data without validation. NAV won't allow you to change the base unit of measure if there are any transactions for the item, as you are now finding out. It also will not post a transaction if there is no base unit of measure. This means that somehow the base unit of measure got removed after those transactions were posted. You should really try to find out how it happened, because you don't want any regular process in your system to be removing any values in that field. Item ledger transactions are in base unit of measure, and you do not want that to change outside of normal validation.

    The only way to get it back is to hack it back, either by developing a process like a page with a button that sets it without validating the field and without running OnModify, or by going into SQL Server and setting it there. You will not be able to change it back manually.
  • bilalraibilalrai Member Posts: 50
    edited 2017-08-01 Answer ✓
    I have gone through the scenario you described above. A simple solution of this is that you should go to NAV Dev and Design Table Item 27. Go to field no. 8 Base Unit of Measure. Press F9 and go to its C/AL code and comment OnValidate trigger for this field( Base Unit of Measure). Then restart client and assign Base Unit of Measure. Post your sales order and then again uncomment this trigger. Image is also attached. But its really strange how Unit of Measure is removed if it has some open ledger entries.
    xsewtt5o9uh2.png
  • JohnHunterJohnHunter Member Posts: 45
    Answer ✓
    Item."Base Unit Of Measure" := 'YourValue';
    Item.MODIFY;
    eg., what DenSter suggested.

Answers

  • DenSterDenSter Member Posts: 8,307
    Answer ✓
    If you are having that issue in production, then you have a serious problem with someone accessing your data without validation. NAV won't allow you to change the base unit of measure if there are any transactions for the item, as you are now finding out. It also will not post a transaction if there is no base unit of measure. This means that somehow the base unit of measure got removed after those transactions were posted. You should really try to find out how it happened, because you don't want any regular process in your system to be removing any values in that field. Item ledger transactions are in base unit of measure, and you do not want that to change outside of normal validation.

    The only way to get it back is to hack it back, either by developing a process like a page with a button that sets it without validating the field and without running OnModify, or by going into SQL Server and setting it there. You will not be able to change it back manually.
  • MathanMathan Member Posts: 55
    Thanks for your response Denster, Yes the issue is in the production. And I believe they won't give us the access to the SQL Server.
    Is it possible or a way to create a report to run a batch job without validating the field and without running OnModify? Can you give a small example or a tip?

    Thanks,
    Mathan
  • bilalraibilalrai Member Posts: 50
    edited 2017-08-01 Answer ✓
    I have gone through the scenario you described above. A simple solution of this is that you should go to NAV Dev and Design Table Item 27. Go to field no. 8 Base Unit of Measure. Press F9 and go to its C/AL code and comment OnValidate trigger for this field( Base Unit of Measure). Then restart client and assign Base Unit of Measure. Post your sales order and then again uncomment this trigger. Image is also attached. But its really strange how Unit of Measure is removed if it has some open ledger entries.
    xsewtt5o9uh2.png
  • JohnHunterJohnHunter Member Posts: 45
    Answer ✓
    Item."Base Unit Of Measure" := 'YourValue';
    Item.MODIFY;
    eg., what DenSter suggested.
  • MathanMathan Member Posts: 55
    Thanks people, All your suggestions works.

    I finally went with as Denster suggested and just like Johnhunter's example.

    I created a codeunit and ran it.

    IF Item.GET('Item name') THEN BEGIN
    Item."Base Unit of Measure" := 'Change the BUOM';
    Item.MODIFY;
    END;
  • DenSterDenSter Member Posts: 8,307
    edited 2017-08-01
    Good to hear that you were able to solve the issue, and thanks for following up. Now go on a 'search and destroy' mission to whoever made this change in the first place B)
Sign In or Register to comment.