CAL Programing

navuser1
navuser1 Member Posts: 1,334
Hi All,

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 ?



Plz reply!
Now or Never

Comments

  • pdj
    pdj Member Posts: 643
    Regards
    Peter
  • DenSter
    DenSter Member Posts: 8,307
    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.
  • navuser1
    navuser1 Member Posts: 1,334
    Thanks Daniel =D>
    Now or Never