03-10-2006 11:11 AM
I want to access a global variable declared within a different program from another function module. If the program containing the variable has a running instance, is it possible to get the value of the variable inside the function module?
03-10-2006 11:14 AM
Hi kaushik,
1. Yes we can get it.
2. (programname)varname
3. in debug type as it is
(with brackets)
program = your original progranmae
varname = variable name
regards,
amit m.
03-10-2006 11:16 AM
hi,
do it like this,
check the where used list and find main program where variable is used and then access it like
field-symbol <fs> type any.
data myfield_name(40) type c value '(Program_name)variable_name'.
assign (myfield_name) to <fs>.
now <fs> has the desired value of the variable.
regards,
03-10-2006 11:29 AM
03-10-2006 11:42 AM
Hi,
You can use the following logic :
In the Program where the global variable exist, once the global variable gets a value, export the value to a memory ID
EXPORT <field name > to memory id <id key>.
e.g.
data : l_total type i.
export l_total to memory id z_1011_234.
Now in the FM, import the variable :
data : l_total type i.
import l_total from memory id z_1011_234.
Best regards,
Prashant