Difference between MyCodeunit.RUN and Codeunit.RUN(417,Rec)

amkdmk
amkdmk Member Posts: 34
Is there any difference between MyCodeunit.RUN(Rec) and CODEUNIT.RUN(417,Rec)?

Comments

  • Imranx101
    Imranx101 Member Posts: 21
    No but if you have for example declared any function in the codeunit , you can only call it as MyCodeunit.myfunction() but you cannot call it as CODEUNIT.myfunction.
  • amkdmk
    amkdmk Member Posts: 34
    That's exactly what I want to do and why I asked. Thanks!
  • kriki
    kriki Member, Moderator Posts: 9,121
    Another import thing to remember:

    with CODUNIT.RUN all global variables in the codeunit are cleared each time you run the codeunit.

    With MyCodeunit.RUN the first time all global variables are cleared, but next calls WILL NOT clear them. They keep the same values as when the last call finished.
    To clear the global variables, you need to do a CLEAR(MyCodeunit).
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!