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 information for classes from call stack in abap (like java reflection)

Former Member
0 Kudos

Hi,

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.

example:

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:

CALL_CLASS: CL_ABC

CALL_LINE: 83

MSG: test the code

any ideas?

1 ACCEPTED SOLUTION

alejandro_bindi
Active Contributor
0 Kudos

You can use the SYSTEM_CALLSTACK function module.

Read this thread, Uwe has given details on both getting the calling class and method:

Most probably this solves your needs.

Regards

2 REPLIES 2

alejandro_bindi
Active Contributor
0 Kudos

You can use the SYSTEM_CALLSTACK function module.

Read this thread, Uwe has given details on both getting the calling class and method:

Most probably this solves your needs.

Regards

Former Member
0 Kudos

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