Maximum time we write functions in tables and call them, but it can be written in the codeunit also. How can I decide whether a function should be written in a table or codeunit ?
This is very subjective, and there is no one good answer. You will get different opinions from different people. For me, if it relates to one table, or even only when it relates to one record in a table, then I put the function in the table, so that you can call it from the record variable in other objects, like MyRecordVariable.SomeFunction, without having to create a variable for the codeunit. If it is related to multiple tables, or something that applies generally to a functional area, or that you could apply to multiple functional areas it could be a candidate for a codeunit.
Comments
http://msmvps.com/blogs/kine/archive/20 ... -code.aspx
Peter
RIS Plus, LLC
MVP - Business Apps