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.
Showing results for 
Search instead for 
Did you mean: 

Caller method

0 Kudos


is there a way to read the caller method of my actual method?

I know that i can use a parameter but it is a third-party software.


Method A calls method C

Method B calls method C

Methode A and Method B are third-party and method C is my code.

Now i have to read in method C if the caller is method A or B.

Is there a way in standard? A SAP method?

Thanks for your help!


0 Kudos

Hello Denis,

I suppose you could use the function module 'SYSTEM_CALLSTACK' to find the caller method. But I would like to add that this would be bad design and I would use it as the last resort only.

Thank you,


0 Kudos

ok, but what would be a good design for this problem?

Active Contributor
0 Kudos

How does the third party software know that it should call your method C from their methods A and B? Exits, enhancement points?

Isn't there anything passed through that would let you make the distinction?


P.S. good design is to not work with global variables or tricks like "SYSTEM_CALLSTACK", but rather have all necessary data locally available through the method interface.

Edited by: Thomas Zloch on Feb 9, 2011 12:38 PM

0 Kudos

it was only an example. All methods are implemented by an third-party programmer in our system.

but we don't want to modify more than method C. If we modify method A, B, ... there is a high risk for this process.

0 Kudos

Alternative would be adding and optional parameter where you pass caller name. This way you can adjust all the callers you need and leave those not relevant untouched. It isn't however good design as you make your callee in strong coupling with its callers. Imagine you add another caller, which entails modification of the callee (to interact with new method/object).

You should always program to [Loose coupling|] even in relevance to different methods (not only objects). The more independent objects are the less modification their require. If you have method C built in a way it needs to distinguish which object/method it's worknig with, introduction of new similar method should probably be considered, or controlling that differentation on object level itself (i.e. by setting object's attribute).



0 Kudos

Hi Dennis,

without discussing design questions you can use function module SYSTEM_CALLSTACK.



Active Contributor
0 Kudos


> Hi Dennis,


> without discussing design questions you can use function module SYSTEM_CALLSTACK.


> Regards,


> Clemens

As Ramneek Sharma said in the first response...

Former Member
0 Kudos

This message was moderated.