Application Development 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: 

ABAP Debugger: Extract Dominator Tree Data into Internal Table

peter_atkin
Active Contributor
0 Kudos

Hi All,

In the ABAP debugger we can see the data held in memory via the "Dominator Tree" (memory analysis tool).

Is there a way to get this data into an internal table (similar to getting the call stack via cl_abap_compiler->get_all_refs)?

Thanks in advance

PeteA

3 REPLIES 3

peter_atkin
Active Contributor

OK, sort of found the answer myself.

Here’s two code snippets to get the PROGRAMS and ITAB-HEADS data from the System Area screen tool in the debugger.

.

*&------------------------------------------------------------&*
*& Get System Areas: PROGRAMS
*&-------------------------------------------------------------&*
data: begin of pxa occurs 0, 
head(5) type c, prog like help_info-program, 
rest(35) type c, 
end of pxa.

call 'SAPCORE' id 'ID' field 'PROGRAMS' 
id 'TABLE' field pxa-*sys*. 

*&-------------------------------------------------------------&*
*& Get System Areas: ITAB-HEADS
*&-------------------------------------------------------------&*
data: begin of lt_itab_heads occurs 0,  
num(8) type c,  
shm_vers_id(14) type c,  
tabhid(7) type c,  
name(57) type c,  
fill(10) type c,  
lines(5) type c,  
linesalloc(16) type c,  
label(5) type c,end of lt_itab_heads.

call 'SAPCORE' id 'ID' field 'ITAB-HEADS' 
               id 'TABLE' field itab-*sys*. 

.

The pain is working out the internal table structure. In the debugger you need to select the relevant system area (in this example ITAB-HEADS), then manually work out the column sizes and plug it into the internal table definition. This is because the table below is a long text string!!!

.

Here's the result for the system area data in the LT_ITAB_HEADS internal table:

.

PeteA

Sandra_Rossi
Active Contributor
0 Kudos

Officially, there are only the methods GET_TOTAL_USED_SIZE and GET_MEMORY_SIZE_OF_OBJECT of class CL_ABAP_MEMORY_UTILITIES. For more information, refer to the class documentation in the ABAP backend.

Unfortunately, they can't return the list of top variables.

peter_atkin
Active Contributor
0 Kudos

Hi Sandra,

Yup - I played around with these, but they only bring back aggregated information.

The solution above seems to work for any System Area object.

PeteA