[ABAP] System Callstack (Aufrufreihenfolge) lesen

Möglichkeit 1 (SYSTEM_CALLSTACK)

DATA: it_abap_callstack TYPE abap_callstack.
DATA: it_syst_callstack TYPE sys_callst.

* Callstack ermitteln
CALL FUNCTION 'SYSTEM_CALLSTACK'
  IMPORTING
    callstack    = it_abap_callstack
    et_callstack = it_syst_callstack.

IF sy-subrc = 0.
  cl_demo_output=>write_data( it_abap_callstack ).
  cl_demo_output=>write_data( it_syst_callstack ).

* HTML-Code vom Demo-Output holen
  DATA(lv_html) = cl_demo_output=>get( ).

* Daten im Inline-Browser im SAP-Fenster anzeigen
  cl_abap_browser=>show_html( EXPORTING
                                title        = |Stackaufrufe|
                                html_string  = lv_html
                                container    = cl_gui_container=>default_screen ).

* cl_gui_container=>default_screen erzwingen
  WRITE: space.
ENDIF.

Möglichkeit 2 (cl_abap_get_call_stack)

* Aufrufstapel auslesen
DATA(it_stack) = cl_abap_get_call_stack=>get_call_stack( ).
DATA(it_stack_formattet) = cl_abap_get_call_stack=>format_call_stack_with_struct( it_stack ).

IF sy-subrc = 0.
  cl_demo_output=>write_data( it_stack ).
  cl_demo_output=>write_data( it_stack_formattet ).

* HTML-Code vom Demo-Output holen
  DATA(lv_html) = cl_demo_output=>get( ).

* Daten im Inline-Browser im SAP-Fenster anzeigen
  cl_abap_browser=>show_html( EXPORTING
                                title        = |Stackaufrufe|
                                html_string  = lv_html
                                container    = cl_gui_container=>default_screen ).

* cl_gui_container=>default_screen erzwingen
  WRITE: space.
ENDIF.