‎2006 Jul 20 11:26 AM
Hi all,
I would like to dynamically get the name of the function module within which my INCLUDED code is sitting - i.e. I do not want the includes name or the calling programs name, but the function name within which the include is sitting...
Just like SY-CPROG returns the ABAP program name within which the function is being called, I wish to know what the actual functions name is? Is this possible?
Thanks for any help!
N
‎2006 Jul 20 11:31 AM
Hi nk,
1. use the FM SYSTEM_CALLSTACK
(inside the FM code)
2. It will return an internal table
3. just read the first row (index 1)
and u will get the current FM (which is being called)
regards,
amit m.
‎2006 Jul 20 11:31 AM
Hi nk,
1. use the FM SYSTEM_CALLSTACK
(inside the FM code)
2. It will return an internal table
3. just read the first row (index 1)
and u will get the current FM (which is being called)
regards,
amit m.
‎2006 Jul 20 11:34 AM
You can do that using
CALL FUNCTION 'SYSTEM_CALLSTACK'
BR, JAcek
‎2006 Jul 20 11:38 AM
Hi,
call the FM <b>SYSTEM_CALLSTACK</b>, this will give you the stack table here you can see all the calls.
Regards
vijay
‎2006 Jul 20 11:47 AM
‎2022 Feb 04 6:55 PM
Consider where in the callstack you expect to be since the callstack may contain several function calls.
This logic returns the most recently called function.
LOOP AT cl_abap_get_call_stack=>format_call_stack_with_struct(
stack = cl_abap_get_call_stack=>get_call_stack( )
)
ASSIGNING FIELD-SYMBOL(<stack_line>).
IF <stack_line>-kind = 'FUNCTION'.
function_name = <stack_line>-event.
EXIT.
ENDIF.
ENDLOOP.