码迷,mamicode.com
首页 > 其他好文 > 详细

Global variable in ABAP function group

时间:2019-12-17 20:17:16      阅读:88      评论:0      收藏:0      [点我收藏+]

标签:oar   process   iuc   wot   UNC   局部变量   any   insert   公众号   

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

标签:oar   process   iuc   wot   UNC   局部变量   any   insert   公众号   

原文地址:https://www.cnblogs.com/sap-jerry/p/12056412.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!