Subtotals in ALV using CL_SALV_TABLE

0
7618

[adsenseyu2]

In this tutorial, we will learn how to apply totals and subtotals in ALV report using factory class CL_SALV_TABLE.

To apply Subtotals in ALV,

  • Apply totals on a column in ALV. click here to know
  • Apply SORTing on a column ALV to which you want subtotals using method ADD_SORT(). click here
  • Enable subtotals for the column by passing the parameter while calling the method ADD_SORT().

Classes Used : CL_SALV_TABLE, CL_SALV_AGGREGATIONS and CL_SALV_SORTS.

Create a program in SE38 and copy the below code.

https://gist.github.com/prakash13t/6688ce13ce8eddf42325#file-subtotal_salv-abap

Output with Totals and Subtotals on Airline column:

[adsenseyu1]

alv4

WordPress database error: [Table 'saplearn_wp1.wp_nsex_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_nsex_comments.comment_ID FROM wp_nsex_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 651 AND comment_parent = 0 ORDER BY wp_nsex_comments.comment_date_gmt ASC, wp_nsex_comments.comment_ID ASC