report yhk.
data: num1 type i,
num2 type i,
sum type i.
num1 = 2. num2 = 4.
perform addit.
*&---------------------------------------------------------------------*
*& Form addit
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
form addit.
sum = num1 + num2.
perform out.
endform. "addit
*&---------------------------------------------------------------------*
*& Form out
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
form out.
field-symbols: <fs> type any.
data: l_cstack_tab type sys_callst,
ls_cstack_tab like line of l_cstack_tab.
write: / 'Sum of', num1, 'and', num2, 'is', sum.
call function 'SYSTEM_CALLSTACK'
importing
et_callstack = l_cstack_tab. " internal table
* l_cstack_tab 里就是abap的调用堆栈
write: sy-uline.
loop at l_cstack_tab into ls_cstack_tab.
write: / sy-tabix, ls_cstack_tab-eventtype, ls_cstack_tab-eventname.
clear: ls_cstack_tab.
endloop.
endform. "out
Result.