2011 May 31 3:41 AM
Hi Everyone,
I was wondering how can you access the local variable of a subroutine using ABAP Stack.
E.g.
REPORT A.
...
PERFORM B.
....
FORM B
data : var2
.....
CALL FUNCTION C
ENDFORM
FUNCTION C.
<access var2 here>
ENDFUNCTION.
I only know that you can usually access variables via (PROGNAME)variable and assign it to an <FS>.
Thanks,
Patrick
Hi Everyone,
I was wondering how can you access the local variable of a subroutine using ABAP Stack.
E.g.
REPORT A.
...
PERFORM B.
....
FORM B
data : var2
.....
CALL FUNCTION C
ENDFORM
FUNCTION C.
<access var2 here>
ENDFUNCTION.
I only know that you can usually access variables via (PROGNAME)variable and assign it to an <FS>.
Thanks,
Patrick
2011 May 31 4:09 AM
Hi,
you can't. The local variables are usually created on stack so when you leave the routine all local variables are removed from stack. I am not 100% that ABAP AS allocates the local variables on stack (or at least subset of local variables) but the behavior is same. The local variables are not accessible from outside.
Cheers
2011 May 31 4:14 AM
Hi,
Even if the call is still active? (e.g. there are many more statements after the CALL FUNCTION)?
Thanks,
2011 May 31 4:22 AM
It's still on the stack but still not accessible. Why don't you pass it as a parameter of function C?
Edited by: Martin Voros on May 31, 2011 1:25 PM
2011 May 31 4:22 AM
Hi f0Xg3!,
ABAP stack if i am not mistaken is a way for you to navigate through the flow of objects like programs, screen and other objects in the event of run time.
For a variable which is "LOCALLY" declared in a subroutine and you want to see it in call function... it is not possible. If anyone says its possible please enlighten me too.
Now, when a variable is "LOCALLY" declared, the visibility of this variable is only in the scope of that subroutine.
Any variable that you want to see in a call function, it should be pass over through EXPORTING. Although you may wrote your CALL FUNCTION in that sub-routine... but the CALL FUNCTION is registered or declared in its own Function Group's scope... so the locally declared variable in a subroutine will not be visible.
Hence, I don't think it will work for your idea.
Just my opinion.
Regards,
W. Wilstroth
2011 May 31 4:29 AM
I can't, I'm just implementing an exit. I know that the values are stored in a stack (and the calls are active when this exit is called), I might change values. But I realized that the data I'm trying to change is a local subroutine variable
Oh well, thanks for the help.
2011 May 31 4:33 AM
Probably implicit enhancement points can solve your problem. Overlay the standard routine with your custom code if you really think that it's necessary.
Cheers
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |