Global variable in ABAP function group

Posted sap-jerry

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Global variable in ABAP function group相关的知识,希望对你有一定的参考价值。

Function group is loaded into runtime memory by the FIRST call of a function module inside this function group.
See example below:
I have a global variable defined in function group in X3C/504:

技术图片

Before I call any of the function module in this function group, this global variable is not available - this make senses because the whole function group is NOT loaded into memory.

技术图片

When the first function module is called, the function group is loaded into memory - global variable available:

技术图片

I insert one entry to this table:

技术图片

Now function1 execution is finished, when I entry function module2, this global variable is still available, because the lifetime scope of function group is application level - which means it will always stay in the memory until the application terminates.

技术图片

概括成一句话:function module里定义的局部变量,作用域是function module scope,即module执行完变量就失效,但定义在function group级别的全局变量,生命周期是整个应用,即应用不关闭之前,一直有效。

要获取更多Jerry的原创文章,请关注公众号"汪子熙":
技术图片

以上是关于Global variable in ABAP function group的主要内容,如果未能解决你的问题,请参考以下文章

Python LEGB (Local, Enclosing, Global, Build in) 规则

TensorFlow函数tf.global_variables_initializer()

TensorFlow“模块”对象没有属性“global_variables_initializer”

python main函数中变量默认为global variable

Golang Global Variable access

sess.run(tf.global_variables_initializer()) 做了什么?