‎2012 Feb 29 3:23 PM
Hi All,
There is any way to get the Function Module Name inside that function module?
In debug we can see 2 fields on top showing PROGRAM_NAME and PROGRAM_TYPE. On case of function it shows:
PROGRAM_TYPE: Fucntion
PROGRAM_NAME: Y_XPTO_ABCD
I need at leadt the program name, since the sy-repid only returns the function group name.
Best regards.
‎2012 Feb 29 3:56 PM
Call FM [SYSTEM_CALLSTACK|http://www.sdn.sap.com/irj/scn/advancedsearch?query=system_callstack].
DATA: lt_callstack TYPE abap_callstack,
ls_callstack TYPE abap_callstack_line,
lv_fname TYPE rs38l_fnam.
CALL FUNCTION 'SYSTEM_CALLSTACK'
EXPORTING
max_level = 0
IMPORTING
callstack = lt_callstack.
CLEAR lv_fname.
LOOP AT lt_callstack INTO ls_callstack. " or read INDEX 1
CHECK ls_callstack-blocktype EQ 'FUNCTION'.
lv_fname = ls_callstack-blockname.
EXIT.
ENDLOOP.
IF lv_fname IS INITIAL.
WRITE: / 'Outside of any Function Module'.
ELSE.
WRITE: / 'Inside', lv_fname, 'Function Module'.
ENDIF.Regards,
Raymond
‎2012 Mar 01 7:26 AM
You can also EXPORT the program name to a MEMEORY ID and you can IMPORT it in your FM