Thursday, January 08, 2004

Getting the current call stack

Sometimes, especially inside user-exits that are called in several different places, we need to know where it was called to decide what to do.

Some fields in the "sy" structure can be useful for this: sy-tcode (transaction), sy-repid (current main program), sy-cprog, sy-xprog, sy-xform, etc.

This info might not be enough, however: we might need to know if we are inside a given form, for example, even if we might be several levels below (the form called another form, which in turn called another form, that then called a function, that called our exit..).

To know this, we need to get the current call stack. In debug mode, we can see it by clicking the button "Calls". Getting that info in our programs is just as easy: just use function SYSTEM_CALLSTACK, and you'll get an internal table with that same information.

Labels:

1 Comments:

Anonymous Anonymous said...

Is there a way to get all parameters which all calling subroutines and FM pass to called ones?

1:39 PM  

Post a Comment

Links to this post:

Create a Link

<< Home