0% found this document useful (0 votes)
30 views1 page

Current Call Stack Retrieval Guide

To get information about the current call stack from within a program, the SYSTEM_CALLSTACK function can be used. It returns an internal table containing details of each step in the call stack, like the transaction, main program, current program, and form. This allows determining if a user exit was called from a specific form, even if several levels below, to decide what actions to take.

Uploaded by

otracuentaaux2
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views1 page

Current Call Stack Retrieval Guide

To get information about the current call stack from within a program, the SYSTEM_CALLSTACK function can be used. It returns an internal table containing details of each step in the call stack, like the transaction, main program, current program, and form. This allows determining if a user exit was called from a specific form, even if several levels below, to decide what actions to take.

Uploaded by

otracuentaaux2
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

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.

MOD de func SYSTEM_CALLSTACK

Ej

* consultar la pila de llamadas que conducen a la exit y habilitar la


* generación de lote sólo en uno de las dos ejecuciones
DATA: lit_callstack TYPE SYS_CALLST,
lwa_callstack TYPE LINE OF SYS_CALLST.
CALL FUNCTION 'SYSTEM_CALLSTACK'
IMPORTING
ET_CALLSTACK = lit_callstack.
READ TABLE lit_callstack
INTO lwa_callstack
WITH KEY PROGNAME = 'SAPLV01Z' " Programa
EVENTTYPE = 'FUNC' " Clase de evento
EVENTNAME = 'VB_CREATE_BATCH'. " Nombre de un subrutina
CHECK sy-subrc = 0.

You might also like