04-23-2009 11:32 AM
Hi Experts,
I am using the ALV grid for report output, able to get the average values and it's working fine.
User wants the average calculation only for non-zero values, meaning...
1st row = 50.00
2nd row = 20.00
3rd row = 0.00
4th row = 40.00
5th row = 0.00
In this case current output is '110.00 / 5 = 22. it's working fine.
User requriement is 110 / 3 = 36.67. Is this functionallity possible in ALV ?.
Let me know your valueable suggestion.
Thanks
Raj
04-23-2009 11:41 AM
Hi raj,
Do not go for the standard totalling or average function in the ALV.
instead do the math in your internal table only and have it as a the last line/
like
loop at itab.
if itab-value <> 0.00.
v_total = v_total + itab-value.
count = count + 1.
endif.
at last.
v_average = v_total / count.
clear itab.
itab-value = v_average.
append itab.
endat.
endloop.
04-23-2009 11:41 AM
>In this case current output is '110.00 / 5 = 22. it's working fine.
>User requriement is 110 / 3 = 36.67. Is this functionallity possible in ALV ?.
It is not possible. you need to do that manually and show it at the end.
04-23-2009 1:17 PM
From ALV you cannot do this.
Instead you need to calculate the average using the values in tables.
And then use it to display.;
Regards,
Lalit Mohan Gupta.
04-24-2009 10:26 AM
Hi,
I want calculate the percentage of subtotal values in the same row in alv grid report.
Is this functionality is possible...
Plz let me your suggestion.
04-09-2010 3:23 AM
Hi,
Did you find the solution for this request (ALV average calculation without zero values). If so, can you please send the details.
04-09-2010 6:46 AM
Hi,
Please check this below logic.
clear count.
loop at itab.
if not itab-value = '0.00'.
count = count + 1.
endif.
at last.
v_average = v_total / count.
itab-value = v_average.
append itab.
endat.
endloop.