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.
cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding Function Module

Former Member
0 Kudos
218

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

4 REPLIES 4

Clemenss
Active Contributor
0 Kudos
161

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.

Regards,

Clemens

Former Member
0 Kudos
161

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
161

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.

Regards

Marcin

Former Member
0 Kudos
161

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