Application Development and Automation 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: 
Read only

alv subtotal calculation

Former Member
0 Likes
610

hi gurus,

my query is :

i have to calculate rate per min , p3 = p1/p2 in subtotal column.but in the scenario given below it is just adding all the rpm and giving the total = 0.56 ,

but -3612/13940 = 0.26 is correct.

EX:

amt(P1) minutes (p2) rpm(rate per min)(p3)

9,500.00- 5233 1.82-

1,500.00 3235 0.46

4,388.00 5472 0.80

-


3,612.00- 13940 0.56- -


subtotal of above rows

so i want the subtotal value of p3 as p1/p2 and not just sum

<REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Apr 21, 2008 5:47 PM

4 REPLIES 4
Read only

Former Member
0 Likes
567

This you can do using the Subtotal_text event of alv.

Check the sample code below..

in the event you will have the SUB TOTAL ROW INFORMATION, now divide the P1/P2 and get the P3 value.

modify the P3 value with value calculated , this will show the Changed value.

For information:-

you can find 2 programs one using class, one using Grid Function.

Read only

0 Likes
567

HELLO YASH,

UR REPLY HELPED ME.

BUT A SMALL PROBLEM,

I AM GETTING THE SUBTOTAL THE WAY I WANT LIKE : P3 = ( P1 / P2)

BUT THE SUM AT THE END IS SUMMING UP ALL THE

SUBTOTALS AND DISPLAYING.

IS THERE A WAY WHERE I CAN GET THE SUM ALSO THE SAME WAY LIKE P3 = P1 / P2 FOR THE FIELD P3 ???

REPLY , POINTS WILL BE AWARDED..

Read only

venkat_o
Active Contributor
0 Likes
567

Hi Srikar, ALV does not calculate the way u r expecting, but what u can do is that calculate manually the way u r calculating for column p3(p1/p2) and make it color for that row as subtotal color. Regards, Venkat.O

Read only

Former Member
0 Likes
567

thnks for ur replies now problm is solved

awarded points to suitable answers