Application Development and Automation 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: 
Read only

Programmatically read the ABAP Stack

Former Member
0 Likes
6,993

I need to know if a particular program is in the ABAP stack at a specific point in my code. The program I am looking for is not the calling program so SYST (CPROG, etc.) will not work.

Does anyone know a way (method or function module) to read the ABAP stack?

Thanks,

Mike

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,512

Hi Mike,

you can use the system call ABAP_CALLSTACK like this:

-


...

DATA: BEGIN OF ls_abap_callstack,

mainprogram LIKE sy-repid,

include LIKE sy-repid,

line TYPE i,

eventtype TYPE dbglevtype,

event TYPE dbglevent,

flag_system,

END OF ls_abap_callstack.

DATA: lt_abap_callstack LIKE TABLE OF ls_abap_callstack.

CALL 'ABAP_CALLSTACK'

ID 'DEPTH' FIELD 1

ID 'CALLSTACK' FIELD lt_abap_callstack.

...

-


Kindly regards,

Stefan

3 REPLIES 3
Read only

Former Member
0 Likes
3,512

you can try this class

CL_RECA_SYSTEM_CALLSTACK

Read only

Former Member
0 Likes
3,513

Hi Mike,

you can use the system call ABAP_CALLSTACK like this:

-


...

DATA: BEGIN OF ls_abap_callstack,

mainprogram LIKE sy-repid,

include LIKE sy-repid,

line TYPE i,

eventtype TYPE dbglevtype,

event TYPE dbglevent,

flag_system,

END OF ls_abap_callstack.

DATA: lt_abap_callstack LIKE TABLE OF ls_abap_callstack.

CALL 'ABAP_CALLSTACK'

ID 'DEPTH' FIELD 1

ID 'CALLSTACK' FIELD lt_abap_callstack.

...

-


Kindly regards,

Stefan

Read only

0 Likes
3,512

Thanks Stefan. (I decided to use fm 'SYSTEM_CALLSTACK' instead of the system call). Either way it works great.

Thanks again,

Mike