09-17-2008 3:16 PM
Hi everyone, how was your day?
I need to active the subtotals button. In standard alvs it actives when you push in totals button, but in my Z alv, It doesnt become active... How can I do this?
Thanks a lot.
09-17-2008 3:23 PM
Hi Julio,
Did you check DO_SUM option at field catalog? And also at layout structure parameter (at REUSE_ALV_GRID_DISPLAY FM) you have a field called no_subtotals. If you check it the will not appear, so fill it with a space.
Good luck and regards,
Marcela.
09-17-2008 3:23 PM
you need to pass the sort option then only it will be active by default, if not press the sum button choosing the summable column and then Sort the key column or any column then you can see the subtotal button. this is manually you can make that visible.
if you want programatically then
check this sample code..
REPORT ztest_alv_sort.
TYPE-POOLS: slis.
DATA: it_data TYPE sflight_tab1.
DATA:
it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fcat LIKE LINE OF it_fieldcat,
it_sort TYPE slis_t_sortinfo_alv,
sort LIKE LINE OF it_sort.
START-OF-SELECTION.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_structure_name = 'SFLIGHT'
i_inclname = sy-repid
CHANGING
ct_fieldcat = it_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2.
wa_fcat-do_sum = 'X'.
MODIFY it_fieldcat FROM wa_fcat
TRANSPORTING do_sum WHERE fieldname = 'SEATSOCC'.
SELECT * FROM sflight INTO TABLE it_data
UP TO 20 ROWS.
"Sort will enable the subtotal option
"just check it
sort-fieldname = 'CARRID'.
sort-up = 'X'.
sort-subtot = 'X'.
APPEND sort TO it_sort.
CLEAR sort.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = it_fieldcat
it_sort = it_sort
TABLES
t_outtab = it_data
EXCEPTIONS
program_error = 1.
09-17-2008 3:23 PM
Hi Julio,
Did you check DO_SUM option at field catalog? And also at layout structure parameter (at REUSE_ALV_GRID_DISPLAY FM) you have a field called no_subtotals. If you check it the will not appear, so fill it with a space.
Good luck and regards,
Marcela.
09-17-2008 3:31 PM
Thanks Marcela!
I marked the DO_SUM field in one in filedcatalog, and it works!!
;D Thanks again!