is the runtime of global variables always the entire session?

kenyokenyo Member Posts: 40
EDIT: So i have debugged a little bit and even though i have declared the variables globally , as soon as i leave the codeunit by calling another codeunit and try to use the getfunction , everything is unitialised

according to this post https://forum.mibuso.com/discussion/73254/can-you-access-another-codeunits-variables-during-runtime-via-a-get-function global variables should be stored during RUNTIME anyway so how is it possible that the instance is wiped when i call a getfunction right after leaving it ( i have done this before also )

Answers

  • TallyHoTallyHo Member Posts: 416
    edited 2019-07-02
    If you run the codeunit, and get the variables through your function, the codeunit should be the same handle as it was initially run. If not, you could set the CU property single instance. In that case global variables will be stored during runtime, and after. You can get the content with a different handle.
  • kenyokenyo Member Posts: 40
    edited 2019-07-02
    TallyHo wrote: »
    If you run the codeunit, and get the variables through your function, the codeunit should be the same handle as it was initially run. If not, you could set the CU property single instance. In that case global variables will be stored during runtime, and after. You can get the content with a different handle.

    yea I already tried the single instance property and it's working but i don't know if it would interfere with other functions of that ( enormous ) CU.

    And yes the CU is run ( 51119 in the picture ) but when i call the getfunction from the table 5077 it's a new empty instance , and i can't figure out why.

    thanks for the reply.
  • TallyHoTallyHo Member Posts: 416
    If you run the cu in t5077 and use getfunction in t5077 during the same run of t5077, with the same cu var, that is a global var.. after cu run, it ought to work.
Sign In or Register to comment.