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: 

getting sum in alv

Former Member
0 Kudos
91

can we get the total sum of aparticular field in an alv

3 REPLIES 3

Former Member
0 Kudos
70

Yes we can get

in the fieldcatalog for that field

wa_fieldcat-datatype = 'QUAN' or 'CURR'
wa_fieldcat-do_sum = 'X'.

Former Member
0 Kudos
70

Hello,

In the IT_SORT parameter of REUSE_ALV_LIST_DISPLAY

fill entries for following parameter.

fieldname = plant

subtot = 'X'

append fieldname to it_sort.

fieldname = division.

subtot = 'X'

append fieldname to it_sort.

And it will by default show you subtotals.

For sum you have field "do_sum" in fieldcatalog , set it to 'X' and you should be able to do sum on that field.

Hope that helps.

Regards

Kapadia

***Assigning points is the way to say thanks in SDN.***

Former Member
0 Kudos
70

populate the IT_SORT internal table of REUSE_ALV_GRID_DISPLAY provided in the importing parameters.

fieldname = Company Code

append fieldname to it_sort.

fieldname = division.

append fieldname to it_sort.

If you explicitly need subtotals then add the following line

subtot = 'X'

For obtaining sum you have an attribute "do_sum" in fieldcatalog , set it to 'X' and you should be able to do sum on that field.

Ensure that these should be numeric / currency or quantity datatypes only.

Hope this solves your problem

PS : Please reward points if solution is helpful