‎2017 Oct 14 2:08 AM
‎2017 Oct 15 10:11 AM
You might be looking for the function module SYSTEM_CALLSTACK.
JNN
‎2017 Oct 16 6:53 AM
‎2017 Oct 16 8:48 AM
If it's a local variable, then you should add some custom code to the standard program or class, if possible, via the enhancement framework.
Here is the shortest example if the program is a class pool.
1. declare a public data reference :
CLASS-DATA ref_to_localvariable TYPE REF TO <the type of localvariable>.
Note that you may also need to make public the type of localvariable :
TYPES zztype_localvariable TYPE <type of localvariable>.
2. add an implicit enhancement at the beginning of the method:
ASSIGN ('localvariable') TO <fs_to_localvariable>.
IF sy-subrc = 0.
GET REFERENCE OF <fs_to_localvariable> INTO ref_to_localvariable.
ENDIF.
3. Access the local variable from outside:
FIELD-SYMBOLS <fs_ref_to_localvariable> TYPE classpool=>ref_to_localvariable.
FIELD-SYMBOLS <fs_localvariable> TYPE classpool=>zztype_localvariable.
ASSIGN ('(classpool===CP)ref_to_localvariable') TO <fs_ref_to_localvariable>.
IF sy-subrc = 0 AND <fs_ref_to_localvariable> IS BOUND.
ASSIGN <fs_ref_to_localvariable>->* TO <fs_localvariable>.
" now work with the local variable by using <fs_localvariable>