cancel
Showing results for 
Search instead for 
Did you mean: 

Adding new line "TOTAL" after data group

Dio
Explorer
1,079

Hi Experts,

Name's Dio, I have a need to add a new line after the group data, that new line is the subtotal of the 'WRBTR' field. I've been looking for a way for 3 days and haven't found a way. Please help me to solved this, I appreciate any help.

Capture.JPG

Regards,
Dio

 

Sandra_Rossi
Active Contributor
If your requirement is to display the subtotal, don't do it in the internal table, do it in the display.
View Entire Topic
Dio
Explorer
0 Kudos

Hi,

My requirement was need do subtotal and grand total in itab, I'll do this in display before and I'm using this code:

wa_fieldcat-fieldname  = 'WRBTR'.    " Fieldname in the data table
  wa_fieldcat-seltext_m  = 'Amount Invoice'.   " Column description in the output
  wa_fieldcat-do_sum     = 'X'.
  APPEND wa_fieldcat TO it_fieldcat.

  wa_sort-spos      = 1.
  wa_sort-fieldname = 'ZNME1'.
  wa_sort-up        = 'X'.
  wa_sort-subtot    = 'X'.
  APPEND wa_sort TO it_sort.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      it_fieldcat   = it_fieldcat
      it_sort       = it_sort
    TABLES
      t_outtab      = it_data
    EXCEPTIONS
      program_error = 1

Regards,
Dio