cancel
Showing results for 
Search instead for 
Did you mean: 

How to Sum up the Columns into single row based on date ?

rakesh_94
Participant
0 Kudos

Hi I new to ABAP please help me how to sum up the column value into a single rom on daily/Day wise in Classical ALV report .SAP ABAP

this is my output but i want like below one

Sandra_Rossi
Active Contributor

Please don't post code as image, copy/paste the code as text so that people can edit it. Also don't forget to click the button CODE so that it's nicely displayed and we can read it easily.

Sandra_Rossi
Active Contributor

One easy solution is to save the layout with totals as default variant, and transport this variant with your program.

Anyway, all the possible solutions have been given already in the forum, please search.

Accepted Solutions (0)

Answers (1)

Answers (1)

venkateswaran_k
Active Contributor
0 Kudos

Hi

Before sending the table to ALV display - sort the table on the data and include that sort in ALV display

Also include do_sum = X in field catalog of that numeric column

Example:

 DATA: ls_sort TYPE slis_sortinfo_alv.
  CLEAR  ls_sort.
  ls_sort-spos      =  1.
  ls_sort-fieldname =  'BUDAT'.
  ls_sort-up        =  'X'.
  ls_sort-group     =  'UL'.
  ls_sort-subtot       =  'X'.

  APPEND ls_sort TO lt_sort.
  CLEAR  ls_sort.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program       = g_repid
      i_callback_pf_status_set = alv_status_set
      i_callback_user_command  = alv_user_comm
      i_grid_title             = grid_title
      i_save                   = g_save
      is_variant               = gs_variant
      is_layout                = alv_layout
      it_fieldcat              = alv_fieldcat[]
      it_events                = gt_events[]
      it_sort                  = alv_sort[]    <========  INCLUDED THE SORT 
    IMPORTING
      e_exit_caused_by_caller  = g_exit_caused_by_caller
      es_exit_caused_by_user   = gs_exit_caused_by_user
    TABLES
      t_outtab                 = it_final.   <=== your output table

Finally,

Add the do_sum = X in the field catalog of the column you want to sum up

Regards,

Venkat