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: 

Percentage subtotals in ALV

Former Member
0 Kudos

I need to have percetage subtotals in an OO ALV report. Obvioulsy not the sum of the percetage column but a percentage based on the figures in the report overall. I have used the method GET_SUBTOTALS of CL_GUI_ALV_GRID to allow me to replace the SAP calculated subtotals with my own and this works fine. The problem I have is that if the user sorts the report the SAP derived values return. I have tried to intercept this using the event AFTER_USER_COMMAND and although I can work out the correct subtotals again they are overwritten with the SAP values. Is there another event that I can use or is there a better way to handle this. At the moment I am thinking of removing the sort buttons so the users can't mess up the report!

Rob

3 REPLIES 3

Former Member
0 Kudos

Hi

I don't know there's the problem, the method GET_SUBTOTALS has the parameter ET_GROUPLEVELS, here u can find out which records belong to a certain subtotal.

Max

Former Member
0 Kudos

I have worked this out myself. If I refresh the table dispaly using a soft refresh immediatley after the user command then change the total then refresh again it works.

0 Kudos

I have a similar issue. But did you notice, if the user uses any of the standard Summation,Avg,Mean, your custom formula is overwritten. Also, if you take a printout, your custom formula is over written by standard and also when you export to an excel sheet, your formula is lost (export to local file and then chose excel; direct export to spreadsheet never works).

I noticed only export to HTML file preserves your formula.. Anyways, good that your solution works for you. A soft refresh wasn't enough for me.