前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Global variable in ABAP function group

Global variable in ABAP function group

原创
作者头像
Jerry Wang
修改2019-12-18 14:47:12
8000
修改2019-12-18 14:47:12
举报

I create an enhancement in this function module to print out current session id:

As long as I do not close browser, no matter what operation I perform in WebUI, the session id remains the same, proving that all my operations are done in the same session:

always this guid: 00015255FA163EE40FA21ED6A898F0FA67B01B77

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级别的全局变量,生命周期是整个应用,即应用不关闭之前,一直有效。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档