Skip to Content
avatar image
Former Member

Get the name of a function module within a function module

Hi all,

as anybody an idea how I can get the calling name of a function module within the function module itsself.

ie.

CALL FUNCTION 'Z_TEST_DMO'.

...

Within this function module I want to know the name of the function module. In this case: Z_TEST_DMO. The think is that I want to react on the suffix DMO for some dynamic programming purposes.

sy-repid doesn't give me the necessaty information.

An Classes like CL_ABAP_RUNTIME and so one seems not to be the correct approach. As anyone an idea how I can get the information.

Thanks in advance

Cheers

jm

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Jun 18, 2004 at 10:53 PM

    Hi!

    Something like your issue was discussed before about getting the name of the currently called method.

    And FM of 'SYSTEM_CALLSTACK' was found to be the solution.

    Hope this link works:

    get-name-of-current-method

    *--Serdar

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Serdar,

      thank you very much for your quick help. It solved my problem! Sorry for not having found it in the already discussed thread. My version:

      DATA l_i_callstack TYPE sys_callst.

      DATA l_var_functionname(70) TYPE c.

      FIELD-SYMBOLS <l_callstack> TYPE LINE OF sys_callst.

      CALL FUNCTION 'SYSTEM_CALLSTACK'

      IMPORTING

      et_callstack = l_i_callstack.

      READ TABLE l_i_callstack ASSIGNING <l_callstack>

      WITH KEY eventtype = 'FUNC'.

      IF sy-subrc EQ 0.

      MOVE <l_callstack>-eventname TO l_var_functionname.

      ENDIF.

      Cheers

      Jeannot

      Message was edited by: Jeannot Dr. Muller