Hi Experts,
I have an alv report which should display the subtotals. I have gone through some of the topics in this forum and made changes accordingly.... but still I am not getting the totlas...
I am attaching the code below. Please tell me whats wrong in this one.... I have to get the sub toals and grand total for the field COUNT based on the field BUSAB.
DATA: int_fcat TYPE slis_t_fieldcat_alv,
w_layout TYPE slis_layout_alv,
i_repid LIKE sy-repid.
DATA: gt_sort TYPE slis_sortinfo_alv OCCURS 0 WITH HEADER LINE.
DATA: i_fcat TYPE slis_fieldcat_alv.
DATA: gs_sort TYPE slis_sortinfo_alv.
CLEAR i_fcat.
i_repid = sy-repid.
CLEAR i_fcat.
i_fcat-fieldname = 'BUSAB'.
i_fcat-seltext_l = 'Dunning Clerk'.
i_fcat-outputlen = '13'.
i_fcat-tabname = 'ITAB'.
APPEND i_fcat TO int_fcat.
CLEAR i_fcat.
i_fcat-fieldname = 'AUSDT'.
i_fcat-seltext_l = 'Dunning Date'.
i_fcat-outputlen = '13'.
i_fcat-tabname = 'ITAB'.
APPEND i_fcat TO int_fcat.
CLEAR i_fcat.
i_fcat-fieldname = 'BUKRS'.
i_fcat-seltext_l = 'Company Code'.
i_fcat-outputlen = '13'.
i_fcat-tabname = 'ITAB'.
APPEND i_fcat TO int_fcat.
CLEAR i_fcat.
i_fcat-fieldname = 'KUNNR'.
i_fcat-seltext_l = 'Customer'.
i_fcat-outputlen = '13'.
i_fcat-tabname = 'ITAB'.
APPEND i_fcat TO int_fcat.
CLEAR i_fcat.
i_fcat-fieldname = 'COUNT'.
i_fcat-seltext_l = 'Count'.
i_fcat-outputlen = '8'.
i_fcat-tabname = 'ITAB'.
i_fcat-do_sum = 'X'.
APPEND i_fcat TO int_fcat.
CLEAR gs_sort.
gs_sort-fieldname = 'BUSAB'.
gs_sort-spos = 1.
gs_sort-up = 'X'.
gs_sort-subtot = 'X'.
APPEND gs_sort TO gt_sort.
w_LAYOUT-TOTALS_TEXT = 'TOTAL'.
w_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
w_LAYOUT-SUBTOTALS_TEXT = 'SUB TOTAL'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = i_repid
I_STRUCTURE_NAME = 'ZFIDSSTRUCT'
IS_LAYOUT = w_layout
IT_FIELDCAT = int_fcat[]
it_sort = gt_sort[]
TABLES
t_outtab = itab
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.