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: 

Subtotals in ALV Tree at every node

stri01
Explorer
0 Kudos
302

 

Hi,

I have an ALV Tree like this

stri01_0-1724567067262.png

Here I want the subtotals for every node in their parent node level. So those nodes should have the summation of it's child node values instead of 0.00 - In this case GL Senders should be added to GL Account, GL Accounts to FS Items, FS Items to TSIJ.

I have used cl_salv_tree=>factory method to make the ALV Tree. I have checked there is a do_sum method but that only works for Field Catalogues. 

Can you please help me with an example code on how to do it?

Thanks in advance!

1 REPLY 1

Sandra_Rossi
Active Contributor
231

Sorry but CL_SALV_TREE doesn't contain a method named DO_SUM.

There is no concept of "field catalog" in SALV.

For totals, averages and so on, use the "aggregations":

tree->get_aggregations( )->add_aggregation(
                                 columnname  = 'YOUR_COLUMN_NAME'
                                 aggregation = if_salv_c_aggregation=>total ).