Using standard Navision we have limited certain dimension combinations to ensure that Customer A does not receive items which are Customer B’s own brands and vice versa. Unfortunately Navision does not check these combinations until you post the shipment. TOO LATE! As the goods have gone out the door. Has anyone modified sales order release to do the dimension checking that takes place at shipment posting time? If so please post details.
In the OnRun trigger of Codeunit 414 Release Sales Document we have added a call to a function called CheckDocDim. Seems to work well. The function is as below; Global Variables SalesLine Record Sales Line DocDim Record Document Dimension DimMgmt Codeunit DimensionManagement //Check that the dimension codes used are valid combinations DocDim.RESET; DocDim.SETRANGE(“Table ID”,36); DocDim.SETRANGE(“Document Type”,“Document Type”); DocDim.SETRANGE(“Document No.”,“No.”); IF DocDim.FIND(’-’) THEN BEGIN IF NOT DimMgmt.CheckDocDimComb(DocDim) THEN ERROR(‘You are using an invalid combination of Dimension Codes on the Sales Header’); END ELSE ERROR(‘You have not specified a Dimension Code on the Sales Header’); SalesLine.RESET; SalesLine.SETRANGE(“Document Type”,“Document Type”); SalesLine.SETRANGE(“Document No.”,“No.”); SalesLine.SETRANGE(Type,SalesLine.Type::Item); IF SalesLine.FIND(’-’) THEN BEGIN REPEAT DocDim.RESET; DocDim.SETRANGE(“Table ID”,37); DocDim.SETRANGE(“Document Type”,“Document Type”); DocDim.SETRANGE(“Document No.”,“No.”); DocDim.SETRANGE(“Line No.”,SalesLine.“Line No.”); IF DocDim.FIND(’-’) THEN BEGIN IF NOT DimMgmt.CheckDocDimComb(DocDim) THEN ERROR(‘You are using an invalid combination of Dimension Codes on Sales Lines %1’,SalesLine.“Line No.”); END ELSE ERROR(‘You have not specified a Dimension Code on Sales Line %1’,SalesLine.“Line No.”); UNTIL SalesLine.NEXT = 0; END;