09-05-2006 9:24 AM
Hi all,
Understand that we can use the following code to achieve Subtotal for a particular ALV column by setting the attributes of the field catalog:
<fs_gt_fieldcat>-DO_SUM = 'X'.
However, what I wish to achieve is to perform my own 'subtotal calculation' rather that the cumulative subtotal of a particular column.
For instance, Gross weight (BRGEW), I have this column in my ALV, and I realize that we can achieve subtotal by changing the field catalog of BRGEW, however, what I wish to do is to perform my own subtotal calculation (e.g. Gross Weight Subtotal divided by number of records listed in ALV) for this column. Can this be achieved?
Appreciate your advise.
Many thanks,
Patrick
09-05-2006 10:22 AM
This can be done through EVENT subtotal_text of cl_gui_alv_grid
definition
Handle total for each column
METHODS handle_subtotal_text
FOR EVENT subtotal_text OF cl_gui_alv_grid
IMPORTING es_subtottxt_info
ep_subtot_line
e_event_data.
implementation
handle total of each column
METHOD handle_subtotal_text.
handle the routine for changing the subtotal
PERFORM change_total_line
USING ep_subtot_line
e_event_data.
ENDMETHOD.