Can we modify a sub-total in ALV
I have a requirement for ALV where following are my values
CVAL PVAL DIFF PERCENTAGE
0.000 587.000 0.000 100.0-
0.000 463.000 0.000 100.0-
0.000 181.000 0.000 100.0-
0.000 1,231.000 0.000 300.0-
Now my calculation for percentage is
((CVAL - (PVAL + DIFF)) / (PVAL + DIFF) ) * 100
So my percentage here (-100) is correct for individual rows
but my ALV GRID subtotal says (-300) which is incorrect.
Any idea how to go for this
Naimesh Patel replied
Yes it is possible.
First, you need to get the ALV object from the ALV function module. You can use the FM GET_GLOBALS_FROM_SLVC_FULLSCR to get the ALV object.
Second, you need to Get the Subtotal from that ALV object using the GET_SUBTOTALS method. Get the table ep_collect01.
Third, you need to modify the subtotal. For this you need to take help of the field-symbols.
Fourth (and last) you need to referesh the ALV display by calling method REFRESH_TABLE_DISPLAY.
You can check out this blog for more information: [Classical ALV: Change Subtotal.|http://help-abap.blogspot.com/2008/09/classical-alv-change-subtotal.html]