Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to make Totals and Subtotals Button to appear on ALV toolbar.

Former Member
0 Kudos

Hi!

I have two reports made by others.. Both of them use REUSE_ALV_LIST_DISPLAY function to diplay the data to the user. But one of them has a "Total" and a "Subtotal" button that appears on the ALV toolbar and the user can use them. However the other report also uses REUSE_ALV_LIST_DISPLAY function but there is no "Total" and "Subtotal" buttons.

What is the trick or option that makes them appear on the toolbar ?

would you please show me ?

Regards.

Erk.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

In your code, for any quantity field, make do_sum = 'X', for fieldcatalog of that field, and the button will appear on ALV.

Revert back if further query.

Reward points if useful.

Regards,

Atish

8 REPLIES 8

Former Member
0 Kudos

Hi,

In your code, for any quantity field, make do_sum = 'X', for fieldcatalog of that field, and the button will appear on ALV.

Revert back if further query.

Reward points if useful.

Regards,

Atish

Former Member
0 Kudos

Hi,

You need to create your own pf-status(in a form and use this form name while passing to the fn module 'REUSE_ALV_LIST_DISPLAY')and add the buttons to the toolbar

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = sy-repid

is_layout = s_layout

<b>i_callback_pf_status_set = 'SET_PF_STATUS'</b>

i_callback_user_command = 'USER_COMMAND'

it_fieldcat = it_fcat

TABLES

t_outtab = itab

Now in the form 'SET_PF_STATUS'.

FORM set_pf_status USING extab TYPE slis_t_extab.

SET PF-STATUS 'TEST2'. (double click on this and add the two buttons)

ENDFORM.

Regards,

Vidya.

0 Kudos

Hi,

The display of Total button depends upon the DATA TYPE of the data displayed. If the data type is CHAR the totals button will not be displayed. Try to change the data type. Also make all DO_SUM = 'X'

Regards,

Vipin.

Former Member
0 Kudos

hi,

check the following link:

http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_pfstatus.htm

Hope this helps.

Reward if helpful.

Regards,

Sipra

rahulkavuri
Active Contributor
0 Kudos

Goto SE41 ... program is SAPLKKBL, here you see many statuses , all are useful....

you can simply copy them onto your existing program

Message was edited by:

Rahul Kavuri

Former Member
0 Kudos

Hi,

Create a copy of std status "STANDARD_FULLSCREEN"

from std prog "SAPLSLVC_FULLSCREEN".

Add one more button to it with a fn code.

call this pf-status in a form.

Finally pass this form name in the

FM parameter "I_CALLBACK_PF_STATUS_SET".

Former Member
0 Kudos

Hi,

The reason could be this.

In the function module " REUSE_ALV_LIST_DISPLAY" there is an Exporting parameter IT_EXCLUDING. If we pass the function codes in this internal table those wouldn't be displayed in the output. Please check if the particular program is passing the values to this parameter.

Let me know if this answers your query. Else paste the function modules of both the reports.

Regards,

Pradeep Chintala.

former_member223537
Active Contributor
0 Kudos

Hi,

Pass "DO_SUM" = "X" in the fieldcatlaog against the field which is to be totalled.

wa_fieldcatalog-fieldname = 'VERME'.

wa_fieldcatalog-tabname = 'I_OUTPUT'.

wa_fieldcatalog-no_out = ' '.

<b> wa_fieldcatalog-do_sum = 'X'.</b>

wa_fieldcatalog-emphasize = 'C6'.

wa_fieldcatalog-seltext_l = text-025.

APPEND wa_fieldcatalog TO i_fieldcatalog.

v_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

i_callback_program = v_repid

  • I_CALLBACK_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

i_structure_name = 'i_output'

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

<b> it_fieldcat = i_fieldcatalog[]</b>

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

i_save = 'A'

  • IT_EVENTS =

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • I_HTML_HEIGHT_TOP =

  • I_HTML_HEIGHT_END =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

t_outtab = i_output[]

EXCEPTIONS

program_error = 1

OTHERS = 2

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

Best regards,

Prashant