Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
Showing results for 
Search instead for 
Did you mean: 

Regarding Function Module

Former Member
0 Kudos

Dear All,

can anybody tell me what are global and local varilables in Function Module ? Where they defined ? Are Global varialble defined in function group ? Please , do needful regarding it .....l


Active Contributor
0 Kudos

Hi TVC6784,

all variables declared in TOP include of the function group are global, all others including interface parameters are local.

Exception: You can 'globalize' the function interface. SAP says this is obsolete but still it is possible and frequently used by SAP. If you do so, the interface parameters are global varianles in the function group, but, at run time only if the function with globalized parameters is called.



Former Member
0 Kudos

Hi Clemens Li ,

Thanks for your needful reply..... Can you just tell me that global variables defined in function group can be used by any function module which is exist in that particular function group ? And If i call any function module between Loop and Endloop than are their global variables values changed or their local variables ?

Edited by: TVC6784 on Sep 18, 2010 7:08 PM

0 Kudos

Global variables in Functon Group (FG) are the same what STATIC variables are for program. When you call any FM from the FG, whole FG is loaded to the memory. This means that every change that goes to its global variable will reflect in all the function modules you call in your program. As long as the FG stays in the memory (till report is not finished) you can use these global variables accross all FMs of that FG. So every FM call while looping will see changed global variables.

In contrary, all variables of FM which you call are local ones, meaning after each new call they receive initial value.



Former Member
0 Kudos

Moderator message - Please do not ask or answer basic/easily searchable questions - thread locked Rob