Hi all,
I'm currentlyhaving difficulties working with the subtotal and the grandtotal. I have the code in the right place like the sort table
CLEAR k_sort.
ADD 1 TO k_sort-spos.
k_sort-fieldname = pv_fieldname.
k_sort-up = c_x.
k_sort-subtot = pv_subtot.
APPEND k_sort TO i_sort.
and the fieldcatalog
CLEAR k_fieldcat.
add 1 to k_fieldcat-col_pos.
k_fieldcat-fieldname = pv_fieldname.
k_fieldcat-tabname = c_tabname.
k_fieldcat-seltext_l = pv_seltext.
k_fieldcat-outputlen = pv_outputlen.
k_fieldcat-datatype = pv_datatype.
k_fieldcat-do_sum = pv_dosum.
APPEND k_fieldcat TO i_fieldcat.
but it didn't seems to show both the total and subtotal. Even the icon is not displayed at the ALV toolbar. The field which I need the total is a currency field. I even try other fields (interger fields) but with no luck. I'm using REUSE_ALV. Any help is greatly appreciated.
hi,
In field catalog for the particular column which you want to sum make that as 'X'.
say
WHEN'MATNR'. it_fcat-do_sum = 'X'. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING i_callback_program = report_id i_grid_title = ws_title * i_callback_top_of_page = 'TOP-OF-PAGE' is_layout = wa_layout it_fieldcat = i_fieldcat[] it_sort = i_sortcat i_save = 'A' it_events = i_events TABLES t_outtab = i_reportdata1 EXCEPTIONS program_error = 1 OTHERS = 2. IF sy-subrc <> 0.
This will enable.
Add a comment