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的原创文章,请关注公众号"汪子熙":

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

时间: 2024-10-03 23:04:02

Global variable in ABAP function group的相关文章

ABAP function group和Tomcat library重复加载问题

ABAP ABAP help文档里对**LOAD-OF-PROGRAM"的关键字是这样描述的: This event keyword defines the program constructor of an executable program, a module pool, a function group, or a subroutine pool. The program constructor is an event block whose event is raised by the

USE " cc.exports.* = value " INSTEAD OF SET GLOBAL VARIABLE"

Cocos2d-x 3.5的lua项目生成后,变成了MVC模式,并且,加入了一个全局变量的检测功能.也就是说,你不小心用了全局变量,他会提示你出错! 比如 local temp = 1 temp = 10 print(temp) 你写成了 local temp = 1 tepm = 10 –这里写错了 print(temp) 然后,print结果就会不同,同时你还会创建一个 全局的 tepm 永远不会被释放.这种问题,在lua中很容易遇到(虽然现在有代码提示 还是不太容易出现,但是谁说的准呢!)

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

在python的main函数中的变量默认为全局变量,而其他的def函数中的变量则默认为局部变量. 当然,局部变量会优先于全局变量,在执行formal_print(t_global)语句时便可看出. 测试代码如下: <span style="font-size:18px;">#coding=utf-8 #测试python的全局变量,局部变量的机制 def formal_print(s_global):#常规的传参用法,传递参数进行print,变量名可任意 print &quo

Function group中的含有的一些内容

1:function group中包含有function module, 各种常量和form等. 2: field都是在include中定义的 3:总体的结构图 原文地址:https://www.cnblogs.com/liyafei/p/11128085.html

Global UNIX file system cylinder group cache

A global?cylinder?group?(CG) cache is stored in file server memory and shared by a plurality of file systems supported by the file server. The global CG cache comprises a number CG entries which are pre-allocated in memory. As different file systems

abap function module中的异常处理

1: 定义一个有异常抛出的function module.  (zfm_moudle6),  该函数中有符合exceptions中的异常,将会自动将exceptions中的异常抛出. FUNCTION ZFM_MOUDLE6. *"---------------------------------------------------------------------- *"*"Local Interface: *" RAISING *" CX_SY_AR

Global &amp; Local Variable in Python

Following code explain how 'global' works in the distinction of global variable and local variable. 1 var = 'Global Variable' 2 print(var) 3 4 def func1(): 5 var = 'Local Variable' 6 print(var) 7 8 def func2(): 9 print(var) 10 11 def func3(): 12 glob

PA教材提纲 TAW12-1

Unit1 Introduction to Object-Oriented Programming(面向对象编程介绍) 1.1 Explaining the Object-Oriented Programming Model(解释面向对象编程) 编程语言发展史: 最早的语言是面向过程语言( procedural programming ): COBOL 差不多同时出现了面向对象( object-oriented programming )和面向逻辑与过程( logical and procedu

YASM User Manual

This document is the user manual for the Yasm assembler. It is intended as both an introduction and a general-purpose reference for all Yasm users. 1.?Introduction Yasm is a BSD-licensed assembler that is designed from the ground up to allow for mult