This is a test message to test the length of the message box.
Login

ABAP Quick - Callstack

Sometimes you want to know where you stand or just to make sure that the program or the method was called at the right time? We help you out with this simple implementation.

There is a simple function module in the system for reading the current callstack. With SYSTEM_CALLSTACK you get the current call for the currently running code.

 

Example

The implementation as the following example:


DATA lt_stack TYPE abap_callstack.

" Get the actual callstack
CALL FUNCTION 'SYSTEM_CALLSTACK'
  EXPORTING
    max_level = 0
  IMPORTING
    callstack = lt_stack.

 

As a result, you get a table with the most important information, such as:

  • Program/include
  • Code line
  • Blocktype/-name

 

ABAP debugger callstack

 

Parameter

As the documentation of the function modules describes, only the exporting parameter callstack should be used, since it also contains all the information and the parameter et_callstack is obsolete.

If all information is needed, the level remains at 0. If only the last x-levels are needed, for example because the position is called in a standard program or a user exit, then a small number of the last calls is sufficient.

 

Conclusion

With the simple function module you can implement many checks and features in a large application or implement security features. Your imagination knows no bounds.


Included topics:
QuickCallstack
Comments (0)

ABAP - ALV still relevant in 2022?

Category - ABAP

Today the joking question, do we still need reports that generate ALV outputs in 2022? In this article, we want to look into this question.

07/01/2022

ABAP in Change

Category - ABAP

The programming language ABAP has been changing for years and is being modernized in various concepts. In this article, we'll look at it in detail.

06/24/2022

ABAP Quick - Clean Core

Category - ABAP

In this article something about Clean Core, what does it mean for the developer, what are the requirements and what do you have to pay attention to.

06/17/2022

ABAP Quick - Processing in a new task

Category - ABAP

This tip is about asynchronous processing in a new process and what to look out for.

01/07/2022

ABAP Quick - Convert JSON to internal

Category - ABAP

In this little tip, we'll go into how you can convert a JSON stream to an internal format and then use it properly.

12/10/2021