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: 

ABAP : Running total in alvgrid

aneel_munawar
Participant
0 Kudos

Dear ABAP Experts,

How can I add running sum in alvgrid.? I have developed a code but when user sorts on anycolumn then the total becomes wrong because it has been calculated in the code. Is there any auto feature in alvgrid.?

Regards

Aneel

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

You may be required to either

  • Prevent sort management by user
  • Handle event after_refresh to recalculate running total after analyzing the sort criteria and using get_sort_criteria , get_filtered_entries , get_subtotals and refresh_table_display  methods (also prevent infinite loops as refresh_table will trigger another after_refresh)

Regards,

Raymond

7 REPLIES 7

raymond_giuseppi
Active Contributor
0 Kudos

You may be required to either

  • Prevent sort management by user
  • Handle event after_refresh to recalculate running total after analyzing the sort criteria and using get_sort_criteria , get_filtered_entries , get_subtotals and refresh_table_display  methods (also prevent infinite loops as refresh_table will trigger another after_refresh)

Regards,

Raymond

0 Kudos

Thanks, I have disabled the sort option.

Regards

Aneel

0 Kudos

Hi,

Is event AFTER_USER_COMMAND ( cl_gui_alv_grid ) could be useful in this case ?

Regards.

0 Kudos

I have simply disabled the sorting option of the grid. I have used this option to prevent the data validity. Other options can be used but the above option fulfilled my client's requirement.

Regards

Aneel

0 Kudos

Hi,

I was just consulting one of my gurus for my own knowledge.

The question was addressed to

Regards.

0 Kudos

You could try this event, but can we take it for granted that the sub-totals have already been recalculated by ALV at this step and that our changes will not be overwritten?


This is why I prefer the event after_refresh which (AFAIK) is the last one before re-display of grid.

Regards,

Raymond

0 Kudos

Hi,

Got it .

Thanks.

p.s. Your response is like a Jet