Skip to Content
May 18, 2006 at 11:26 PM

Function module equivalent


does anybody know how to identify within a function module what it's name is? i.e. is there a similar variable to sy-repid to identify what the current function module is?

I know sy-repid will identify the main program of the function group, I want the name of the function module.

I am creating a mechanism to log the parameters sent to calls of function modules. I have created a custom table to hold the data and one of the key fields is the name of the function module. Currently I hard-code the name when I enable this logging within a function module but I wondered if there is a variable somewhere which holds the name.

This mechanism will be used by many function modules and I can't change the interfaces, say to use a new parameter. I want this function to be able to be plugged into any fm I choose.

The prototype mechanism needs a few lines of code inserted in each fm that's going to be log-enabled. It uses a macro which takes the function module name as a parameter, works out what the parameters are called and what their values are and puts them in a custom table. Then there is an associated report which browses this table and formats the parameters appropriately.


It seems this can't be done. Rob is right that the name is knowable but I think it's hidden away in the deep magic of the kernal. Any more ideas before I close the thread?

Further Update:

thanks Stefan - this looks exactly what I need. I will check it out thoroughly before awarding you full points!


SYSTEM_CALLSTACK works perfectly for my purposes. I no longer have to hard-code the name of the function module I am trying to log.