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: 

Subtotal in ALV

Former Member
0 Kudos

Hello SDNites,

I am working on ALV List. Have done totaling on my output report using do_sum field of field catalog. Working fine.

But I have a requirement where I need to divide sum of two values.

Ex.

Actual Hours Actual Am Avg. Pric

3,646.000 3,985.60 1.09

250.000 19,525.22 78.1

384.000 26,265.00 68.4

1,611.000 28,027.20 17.4

510.000 1,500.00 2.94

6,401.000 79,303.02

Here 6,401.000 and 79,303.02 is total of respective columns. now i need to perform (79,303.02 / 6,401.000) and show it in Avg. Pric column. Please let me know how can i achieve the same using ALV List functionality.

5 REPLIES 5

narin_nandivada3
Active Contributor
0 Kudos

Hi Abhishek,

Please go through these threads

Please check this WIKI which would help you more..

https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/include%2bline%2bafter%2bsubtotal%2bin%2...

Check the Sample code in the below link

[SUBTOTAL in ALV LIST|http://www.sap-basis-abap.com/sapalv.htm]

Hope this would help you to solve the issue.

Good luck

Narin

Former Member
0 Kudos

Former Member
0 Kudos

Didn't work out.

0 Kudos

Hi Abhishek, You can not get that using ALV functionalities. That u have to calculate before u pass the internal table to REUSE* function module. Once your internal table is ready with data, 1. Loop the internal table, calculate the sums for the Actual Hours Actual Am, using under event AT LAST-ENDAT. calculate avg of those two. 2. Add those three values as another row(last row). That is ur ALV sum row. 3. Color the row using ALV functionality. I hope that you will get it . Regards, Venkat.O

Former Member
0 Kudos

Here 6,401.000 and 79,303.02 is total of respective columns. now i need to perform (79,303.02 / 6,401.000) and show it in Avg. Pric column. Please let me know how can i achieve the same using ALV List functionality

as u had make column for total in the same u have to create a column for avrg. to and get avarage in anather variable and display it in the respecive column.

else give me code i will check

regards

anil chaudhary