Get the value of a field dynamically using system_callstack
My requirement is to get the value of a field used in a program which is available in my call stack while debugging.
I am using FM system_callstack but it just gives an internal table comprising of 3 fields programname, event type and event name.
I do not know how to retrieve the value of a variable being used in one of the programs.
My sample code is
CALL FUNCTION 'SYSTEM_CALLSTACK'
et_callstack = l_cstack_tab. " internal table
READ TABLE l_cstack_tab INTO l_cstack_wa INDEX 4.
IF sy-subrc = 0 AND l_cstack_wa-progname IS NOT INITIAL.
l_evt_class = l_cstack_wa-progname.
then what shud I do.*********************
Darren Barton replied
Try using an external assign the read the call stack, e.g.
data: lv_name(30) type c, lv_lgbkz type lvs_lgbkz. field-symbols: <fs> type any. lv_name = '(SAPLL03A)I_MLVS-LGBKZ'. assign (lv_name) to <fs>. if ( <fs> is assigned ). ............... endif.
Where the value in lv_name is the program and variable name from the call stack.