Skip to Content
author's profile photo Former Member
Former Member

Subtotal in ALV

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,


Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Sep 05, 2006 at 09:22 AM

    This can be done through EVENT subtotal_text of cl_gui_alv_grid


    • Handle total for each column

    METHODS handle_subtotal_text

    FOR EVENT subtotal_text OF cl_gui_alv_grid

    IMPORTING es_subtottxt_info




    • handle total of each column

    METHOD handle_subtotal_text.

    • handle the routine for changing the subtotal

    PERFORM change_total_line

    USING ep_subtot_line



    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.