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

Enable subtotalling / totalling within the ALV report layout

Hi,

I have a custom report for which I need to get the sub-total and total buttons on the screen. The function called is REUSE_ALV_GRID_DISPLAY and I am populating the it_sort internal table. I am using the default GUI status and have not used :

i_callback_pf_status_set = 'SET_PF_STATUS'

in the function module.

Do I need to create a PF-status for the specific program with the Total button &UMC&.

I would apreciate if I could get some inputs.

regards

Aveek

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 24, 2005 at 06:36 AM

    ALV Totals Option:

    In order to get the totals option on the application toolbar in ALV, we need to pass the data type and the output length (I guess the output is not mandatory), when populating the internal table for field catalogue.

    In order to get the total at the end of the list, we need to set the field ‘DO_SUM’ in the field catalogue internal table.

    EXAMPLE:

    clear ls_fieldcat.

    ls_fieldcat-fieldname = 'GASMG'.

    ls_fieldcat-seltext_m = text-003.

    ls_fieldcat-key = space.

    ls_fieldcat-no_out = space.

    ls_fieldcat-do_sum = ‘X’.

    ls_fieldcat-no_sum = space.

    ls_fieldcat-datatype = 'QUAN'.

    ls_fieldcat-outputlen = '13'.

    append ls_fieldcat to modify_fieldcat.

    REGSRDA,

    KARTIKEY.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 24, 2005 at 06:37 AM

    Aveek,

    The totalling features should be working by default. Just make sure DO_SUM is set to 'X' for the fields for which you want to have the totals.

    REgards,

    Ravi

    Note : Don't forget to reward the answers that help you.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 24, 2005 at 06:45 AM

    Hi,

    U donot want to crete a separete button for tollaing and sub=totalling.Do the following things,

    For Sub-totalling,

    DATA: ls_sort TYPE slis_sortinfo_alv.

    ls_sort-fieldname = 'CARRID'.

    ls_sort-spos = 1.

    ls_sort-up = 'X'.

    ls_sort-subtot = 'X'.

    APPEND ls_sort TO l_sort.

    And pass the l_sort to REUSE_ALV_GRID_DISPLAY

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    • I_INTERFACE_CHECK = ' '

    i_callback_program = w_repid

    • I_CALLBACK_PF_STATUS_SET = ' '

    • I_CALLBACK_USER_COMMAND = ' '

    • I_CALLBACK_TOP_OF_PAGE = ' '

    • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

    • I_CALLBACK_HTML_END_OF_LIST = ' '

    i_structure_name = 'SFLIGHT'

    i_background_id = 'ALV_BACKGROUND'

    • I_GRID_TITLE =

    • I_GRID_SETTINGS =

    is_layout = i_layout

    it_fieldcat = i_fieldcat[]

    • IT_EXCLUDING =

    it_special_groups = i_sp_group[]

    <b> it_sort = l_sort[]</b>

    • IT_FILTER =

    • IS_SEL_HIDE =

    • I_DEFAULT = 'X'

    i_save = w_save

    is_variant = i_variant

    it_events = i_events[]

    • IT_EVENT_EXIT =

    is_print = i_print

    • IS_REPREP_ID =

    • I_SCREEN_START_COLUMN = 0

    • I_SCREEN_START_LINE = 0

    • I_SCREEN_END_COLUMN = 0

    • I_SCREEN_END_LINE = 0

    • IMPORTING

    • E_EXIT_CAUSED_BY_CALLER =

    • ES_EXIT_CAUSED_BY_USER =

    TABLES

    t_outtab = i_sflight

    EXCEPTIONS

    program_error = 1

    OTHERS = 2.

    For Totalling,

    Check this link,

    http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_basic.htm>

    Hope u understood.

    Kindly reward points if u find it useful.

    Thanks&Regards,

    Ruthra

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 24, 2005 at 07:11 AM

    Hi,

    The following code is from standard program.This itself will show the total button.No need of setting anything in pf_status.Kindly reward points by clicking the star on the left of reply,if it helps.

    DATA: GT_SFLIGHT TYPE TABLE OF SFLIGHT.

    SELECT * FROM SFLIGHT INTO TABLE GT_SFLIGHT.

    • Call ABAP List Viewer (ALV)

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    I_STRUCTURE_NAME = 'SFLIGHT'

    TABLES

    T_OUTTAB = GT_SFLIGHT.

    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.