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: 

CL_GUI_ALV_TREE Totals, multiple levels

MaryM
Participant
0 Kudos

Hello gurus,

I have a problem with ALV tree:

I have a tree with varios sublevels:


-node_l1
  -node_l2
    -node_l3
       -node_l4
       -node_l4
       -node_l4
...

Im using the same structure (fieldcat) for all levels, but filling out different fields.

I have one Totals field (do_sum = 'X')

I want to pass my calculated total on level 3, for it to sum up to level 2 and level 1.

The problem is, that it is recalculating the value starting from the lowest level. As I'm not passing any information on level 4, the calculated field total will always be 0.

Is there any way to choose which level of total to calculate?

Can I disable or remove level 4 from my calculation?

Thank you all in advance!

MaryM

2 REPLIES 2

former_member184578
Active Contributor
0 Kudos

Hi.,

Instead of do_sum = 'X' at field catalog for automatic total calculation, You calculate the total manually and append it at level 3.

Loop at itab into wa.

wa_fin-f1 = wa-f1.

lv_total = wa-f1.

at level 3.

wa_fin-f1 = lv_total.

clear lv_total.

end at.

append wa_fin to itab_fin.

endloop.

now itab_fin contains the required Output . and pass this to ALV .

hope this helps u.,

Thanks & Regards,

kiran

0 Kudos

Yes,

Manual calculation is an option. I didn't want to do it in the first place, because there will be a lot of modificacions: adding nodes, deleting notes, changing values, and that means I have to recalculate a lot.

But as there seems to be no other option..

Thanks!

MaryM