Hi,
Does someone know if it is possible to put the current running instance of a codeunit into a variable to use it then as a parameter?
The same that Rec does for a Table Object?
Would need it for a workaround.
thx for your responses, but i think you misunderstood me.
I know that you can pass a codeunit as parameter and i agree that its not that elegant. I could do it differnt but i would have to change quite some code what i would like to avoid.
Anyway my question is:
Is it possible to put the current running instance of a codeunit into a variable, from code within that codeunit? I dont have Rec like i have when i am in a table, but i would like to achieve the same thing.
I am in cuX. From there i want to call a function in cuY with parameter cuX(the current running instance, i dont have a variable to use). Then i make cuY.RUN which calls a function in cuX(has to be the same intance, from where i started).
Hope i made myself clear this time. Anybody a clue if this is possible?
Comments
However, it is not a really elegant solution and other developers will wonder why you did that.
It is done in standard NAV with Assembly Management. Here the reason was to avoid creating multiple registers.
IMHO there are more elegant solutions for that.
I know that you can pass a codeunit as parameter and i agree that its not that elegant. I could do it differnt but i would have to change quite some code what i would like to avoid.
Anyway my question is:
Is it possible to put the current running instance of a codeunit into a variable, from code within that codeunit? I dont have Rec like i have when i am in a table, but i would like to achieve the same thing.
I am in cuX. From there i want to call a function in cuY with parameter cuX(the current running instance, i dont have a variable to use). Then i make cuY.RUN which calls a function in cuX(has to be the same intance, from where i started).
Hope i made myself clear this time. Anybody a clue if this is possible?
if you mark codeunit as SingleInstance=true, NAV will protect this codeunit in memory including all global variables defined in it.