Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

ALV REPORT WITH MULTIPLE BLOCKS - COLUM TOTAL

Hi friends,

In the following code, I am not getting the column total.

--- SAMPLE 1--


CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'

EXPORTING

i_callback_program = sy-cprog

i_callback_user_command = 'USER_COMMAND'.

PERFORM list_append TABLES IT_CTV

USING '1'

'IT_CTV'.

PERFORM list_append TABLES IT_APP

USING '2'

'IT_APP'.

PERFORM f_list_display.

----


  • FORM USER_COMMAND *

----


FORM user_command USING i_ucomm LIKE sy-ucomm

is_selfield TYPE slis_selfield. "#EC CALLED

ENDFORM. " USER_COMMAND

----


  • Form list_append

----


FORM list_append TABLES ut_table

USING u_no TYPE char1

u_tabname TYPE slis_tabname.

DEFINE m_fieldcat.

ls_fieldcat-fieldname = &1.

ls_fieldcat-ref_tabname = &2.

append ls_fieldcat to lt_fieldcat.

END-OF-DEFINITION.

DATA: GT_ZSUM TYPE SLIS_T_SORTINFO_ALV WITH HEADER LINE.

DEFINE m_sort.

ls_sort-fieldname = &1.

ls_sort-up = 'X'.

append ls_sort to lt_sort.

END-OF-DEFINITION.

DATA :

ls_fieldcat TYPE slis_fieldcat_alv,

lt_fieldcat TYPE slis_t_fieldcat_alv, " Field catalog

ls_sort TYPE slis_sortinfo_alv,

lt_sort TYPE slis_t_sortinfo_alv. " Sort table

DATA:

lt_events TYPE slis_t_event,

ls_event TYPE slis_alv_event,

ls_layout TYPE slis_layout_alv.

ls_layout-group_change_edit = 'X'.

ls_layout-colwidth_optimize = 'X'.

ls_layout-zebra = 'X'.

ls_layout-cell_merge = 'X'.

ls_layout-detail_popup = 'X'.

ls_layout-get_selinfos = 'X'.

ls_layout-max_linesize = '300'.

CASE u_no.

WHEN '1'.

ls_fieldcat-SELTEXT_L = ' REGION'.

m_fieldcat 'BZIRK' 'IT_CTV'.

ls_fieldcat-just = 'R'.

ls_fieldcat-SELTEXT_L = ' CTV STOCK'.

m_fieldcat 'CTVST' 'IT_CTV'.

ls_fieldcat-just = 'R'.

ls_fieldcat-SELTEXT_L = ' CTV VALUE'.

m_fieldcat 'CTVVL' 'IT_CTV'.

ls_fieldcat-DO_SUM = 'X'.

m_sort 'BZIRK'.

WHEN '2'.

ls_fieldcat-SELTEXT_L = ' REGION'.

m_fieldcat 'BZIRK' 'IT_APP'.

ls_fieldcat-just = 'R'.

ls_fieldcat-SELTEXT_L = ' RFG STK'.

m_fieldcat 'RFGST' 'IT_APP'.

ls_fieldcat-just = 'R'.

ls_fieldcat-SELTEXT_L = ' RFG VAL'.

m_fieldcat 'RFGVL' 'IT_APP'.

ls_fieldcat-just = 'R'.

ls_fieldcat-SELTEXT_L = ' WM STK'.

m_fieldcat 'WMCST' 'IT_APP'.

ls_fieldcat-just = 'R'.

ls_fieldcat-SELTEXT_L = ' WM VAL'.

m_fieldcat 'WMCVL' 'IT_APP'.

ls_fieldcat-just = 'R'.

ls_fieldcat-SELTEXT_L = ' MCCS STK'.

m_fieldcat 'MOVST' 'IT_APP'.

ls_fieldcat-just = 'R'.

ls_fieldcat-SELTEXT_L = ' MCCS VAL'.

m_fieldcat 'MOVVL' 'IT_APP'.

ls_fieldcat-just = 'R'.

ls_fieldcat-SELTEXT_L = ' APP STK'.

m_fieldcat 'APPST' 'IT_APP'.

ls_fieldcat-just = 'R'.

ls_fieldcat-SELTEXT_L = ' APP VAL'.

m_fieldcat 'APPVL' 'IT_APP'.

ls_fieldcat-just = 'R'.

ls_fieldcat-DO_SUM = 'X'.

m_sort 'BZIRK'.

ENDCASE.

  • ls_fieldcat-COL_POS = 1.

  • ls_fieldcat-FIELDNAME = 'BZIRK'.

  • ls_fieldcat-DO_SUM = 'X'.

  • ls_fieldcat-FIX_COLUMN = 'X'.

  • APPEND ls_fieldcat TO lT_fieldcat.

IF u_no CA '13'.

MOVE 'TOP_OF_PAGE' TO ls_event-name.

CONCATENATE 'TOP_OF_PAGE' u_no INTO ls_event-form.

APPEND ls_event TO lt_events.

ELSE.

MOVE 'TOP_OF_LIST' TO ls_event-name.

CONCATENATE 'TOP_OF_LIST' u_no INTO ls_event-form.

APPEND ls_event TO lt_events.

ENDIF.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

EXPORTING

it_fieldcat = lt_fieldcat

is_layout = ls_layout

i_tabname = u_tabname

it_events = lt_events

it_sort = lt_sort

TABLES

t_outtab = ut_table

EXCEPTIONS

program_error = 1

maximum_of_appends_reached = 2

OTHERS = 3.

IF sy-subrc <> 0.

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

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

ENDIF.

ENDFORM. " LIST_APPEND

----


  • Form f_list_display

----


FORM f_list_display.

DATA ls_print TYPE slis_print_alv.

ls_print-no_print_selinfos = 'X'. " Display no selection infos

ls_print-no_print_listinfos = 'X'. " Display no listinfos

ls_print-reserve_lines = 2. " Lines reserved for end of page

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'

EXPORTING

i_interface_check = ' '

is_print = ls_print

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.

ENDFORM. " F_LIST_DISPLAY

----


  • FORM top_of_page1 *

----


FORM top_of_page1. "#EC CALLED

WRITE 'SALES REPORT'.

PERFORM TOP_LIST1.

ENDFORM.

----


  • FORM top_of_list2 *

----


FORM top_of_list2. "#EC CALLED

WRITE 'STOCK REPORT'.

PERFORM top_of_page.

ENDFORM.

*-----END OF SAMPLE 1 -


Could any help me.

Thanx in advance.

Regards,

A S VINCENT

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question