Monday, December 20, 2010
IT_SORT table has to be passed through REUSE_ALV_GRID_DISPLAY.
REPORT zovh_alv_subtot. DATA: BEGIN OF it_tab OCCURS 0, bukrs TYPE t001-bukrs, dmbtr TYPE dmbtr, END OF it_tab. *ALV Declarations TYPE-POOLS:slis. TYPES: ty_fieldcat TYPE slis_fieldcat_alv, ty_events TYPE slis_alv_event, ty_layout TYPE slis_layout_alv, ty_sort TYPE slis_sortinfo_alv. DATA: wa_fieldcat TYPE ty_fieldcat, wa_events TYPE ty_events, wa_layout TYPE ty_layout, wa_sort TYPE ty_sort. DATA: it_events TYPE STANDARD TABLE OF ty_events, it_fieldcat TYPE STANDARD TABLE OF ty_fieldcat, it_sort TYPE STANDARD TABLE OF ty_sort. DATA: g_program TYPE sy-repid. START-OF-SELECTION. DO 100 TIMES. IF sy-index <= 20. it_tab-bukrs = 100. it_tab-dmbtr = 100. ELSEIF sy-index <= 50. it_tab-bukrs = 101. it_tab-dmbtr = 101. ELSE. it_tab-bukrs = 102. it_tab-dmbtr = 102. ENDIF. APPEND it_tab. CLEAR it_tab. ENDDO. DEFINE fieldcat. wa_fieldcat-fieldname = &1. wa_fieldcat-tabname = &2. wa_fieldcat-seltext_m = &3. wa_fieldcat-do_sum = &4. "To get totals append wa_fieldcat to it_fieldcat. clear wa_fieldcat. END-OF-DEFINITION. fieldcat:'BUKRS' 'IT_TAB' 'BUKRS' '', 'DMBTR' 'IT_TAB' 'DMBTR' 'X'. wa_layout-colwidth_optimize = 'X'. "Events wa_events-name = 'TOP_OF_PAGE'. wa_events-form = 'TOP_OF_PAGE'. APPEND wa_events TO it_events. CLEAR wa_events. "Sort wa_sort-fieldname = 'BUKRS'. wa_sort-tabname = 'IT_TAB'. wa_sort-up = 'X'. "Ascending order wa_sort-group = '*'. "Page break wa_sort-subtot = 'X'. APPEND wa_sort TO it_sort. CLEAR wa_sort. g_program = sy-repid. CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY' EXPORTING i_callback_program = g_program is_layout = wa_layout it_fieldcat = it_fieldcat it_events = it_events it_sort = it_sort TABLES t_outtab = it_tab.
Followers
Popular Posts
- ABAP - ALV Report example with steps
- ABAP - Step by step tutorial on Smart Forms - Template Node
- ABAP - Sending email with pdf attachment
- SAP Adobe Form - Steps to create simple ADOBE Form and calling it from ABAP Program
- SAP ABAP - CL_ABAP_CHAR_UTILITIES class usage
- ABAP - Multiple value selection from F4 help for SELECT-OPTIONS
- Execute ABAP Report using SUBMIT statement
- ABAP - Select all or Deselect all in ALV or Check box handling in ALV
- Web Dynpro ABAP ALV - ON_CLICK event
- ABAP - Dynamic WHERE clause
0 comments:
Post a Comment
Your useful comments, suggestions are appreciated.Your comments are moderated.