Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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.

Former Member replied


you can try FM "SYSTEM_CALLSTACK". Take in the resulting table the first entry with ProgName = SY-REPID and eventType = FUNC. Field Eventname contains FM-Name.

I tested it in some cases and it seems to work. However, I found no official documentation about it!!!

Best regards,


0 View this answer in context

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question