Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Get the name of a function module within a function module

Former Member
0 Kudos

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

2 REPLIES 2

ssimsekler
Active Contributor
0 Kudos

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:

*--Serdar

0 Kudos

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