Skip to Content
avatar image
Former Member

Get information for classes from call stack in abap (like java reflection)


is there any possibilty to get following information:

I want to program a logging tool. You can create a logging object and use some methods like

xxxxx->add_msg(msg) to put logging information to the logging object.

but i also want to find out, from which class/object/runtime environment this msg comes.


class CL_ABC uses the logging tool and does following call:


lo_logger = CL_logger->get_logger().

lo_logger->add_msg( 'test the code' ).


now the method ->add_msg() in logger object is called. inside this method, i want to have the information, from which class/object the ->add_msg() method is called. after the call, the logging object must have this information like:



MSG: test the code

any ideas?

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    Sep 04, 2008 at 02:08 PM

    You can use the SYSTEM_CALLSTACK function module.

    Read this thread, Uwe has given details on both getting the calling class and method: how-to-determine-current-method-interface-method-t

    Most probably this solves your needs.


    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 11, 2008 at 01:55 PM

    Thank you for answer Alejandro Bindi. your answer solved the problem

    Add comment
    10|10000 characters needed characters exceeded