Skip to Content
author's profile photo Former Member
Former Member

SUBTOTAL_TEXT EVENT

Hi all,

I am using the function REUSE_ALV_GRID_DISPLAY and using the event SUBTOTAL_TEXT in my report.

In the subtotal_text event i am using three criteria

on which i need subtotals

1> Plant

2> storage location

3> Material Description

i am geeting the correct output but while printing it showing the subtotal only for plant and storage location and not for material desc.is it not possible in LIST that we can do subtotals upto three levels.if yes what could be the problem???Please help

points will be given to helpful answer

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Nov 30, 2007 at 07:35 AM

    Hi

    code:

    ----


    • Type Pools

    ----


    TYPE-POOLS:slis.

    ----


    • Tables

    ----


    TABLES: vbak,vbap.

    ----


    • Global Variable

    ----


    data: w_var type i.

    ----


    • Global Data

    ----


    DATA:it_fieldcat TYPE slis_t_fieldcat_alv,

    wa_fieldcat TYPE slis_fieldcat_alv,

    it_sortcat TYPE slis_t_sortinfo_alv,

    wa_sortcat LIKE LINE OF it_sortcat.

    ----


    • Internal Table

    ----


    data: BEGIN OF it_salesorder OCCURS 0,

    vbeln LIKE vbak-vbeln, " Sales Document Number

    posnr like vbap-posnr, " Sales Doc Item

    netwr like vbap-netwr, " Net Value

    END OF it_salesorder.

    ----


    • SELECT OPTIONS

    ----


    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

    SELECT-OPTIONS: s_vbeln FOR vbak-vbeln. " Sales Document Number.

    SELECTION-SCREEN END OF BLOCK b1.

    ----


    • Initialization

    ----


    INITIALIZATION.

    PERFORM initialization.

    &----


    *& Form initialization

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    form initialization .

    s_vbeln-sign = 'I'.

    s_vbeln-option = 'BT'.

    s_vbeln-low = '4969'.

    s_vbeln-high = '5000'.

    APPEND s_vbeln.

    endform. " initialization

    ----


    • Start Of Selection

    ----


    START-OF-SELECTION.

    PERFORM field_catalog. "For Structure Creation

    PERFORM fetch_data. "Get the Data From DB Table

    PERFORM sorting USING it_sortcat.

    ----


    • End Of Selection

    ----


    END-OF-SELECTION.

    perform display_data.

    &----


    *& Form field_catalog

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    form field_catalog .

    wa_fieldcat-col_pos = w_var. " Column Position Variable

    wa_fieldcat-tabname = 'IT_SALESORDER'. " Internal Table Name

    wa_fieldcat-fieldname = 'VBELN'. " Field Name

    wa_fieldcat-key = 'X'. " Blue Color

    wa_fieldcat-ref_tabname = 'VBAK'. " Table Name

    wa_fieldcat-ref_fieldname = 'VBELN'. " Field Name

    wa_fieldcat-seltext_m = 'Sales Doc No'. " Display Text In Screen

    APPEND wa_fieldcat TO it_fieldcat.

    CLEAR wa_fieldcat.

    ADD 1 TO w_var.

    wa_fieldcat-col_pos = w_var. " Column Position Variable

    wa_fieldcat-tabname = 'IT_SALESORDER'. " Internal Table Name

    wa_fieldcat-fieldname = 'POSNR'. " Field Name

    wa_fieldcat-ref_tabname = 'VBAP'. " Table Name

    wa_fieldcat-ref_fieldname = 'POSNR'. " Field Name

    wa_fieldcat-seltext_m = 'Sales Doc Item'. " Display Text In Screen

    APPEND wa_fieldcat TO it_fieldcat.

    CLEAR wa_fieldcat.

    ADD 1 TO w_var.

    wa_fieldcat-col_pos = w_var. " Column Position Variable

    wa_fieldcat-tabname = 'IT_SALESORDER'. " Internal Table Name

    wa_fieldcat-fieldname = 'NETWR'. " Field Name

    wa_fieldcat-ref_tabname = 'VBAP'. " Table Name

    wa_fieldcat-ref_fieldname = 'NETWR'. " Field Name

    wa_fieldcat-do_sum = 'X'. " Sum

    wa_fieldcat-seltext_m = 'Net Value'. " Display Text In Screen

    APPEND wa_fieldcat TO it_fieldcat.

    CLEAR wa_fieldcat.

    ADD 1 TO w_var.

    endform. " field_catalog

    &----


    *& Form sorting

    &----


    • text

    ----


    • -->P_IT_SORTCAT text

    ----


    form sorting using p_it_sortcat TYPE slis_t_sortinfo_alv.

    wa_sortcat-fieldname = 'VBELN'.

    wa_sortcat-up ='X'.

    wa_sortcat-subtot = 'X'.

    APPEND wa_sortcat TO p_it_sortcat.

    endform. " sorting

    &----


    *& Form display_data

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    form display_data .

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    • I_INTERFACE_CHECK = ' '

    • I_BYPASSING_BUFFER = ' '

    • I_BUFFER_ACTIVE = ' '

    I_CALLBACK_PROGRAM = SY-REPID

    • I_CALLBACK_PF_STATUS_SET = ' '

    • I_CALLBACK_USER_COMMAND = ' '

    • I_CALLBACK_TOP_OF_PAGE = ' '

    • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

    • I_CALLBACK_HTML_END_OF_LIST = ' '

    • I_STRUCTURE_NAME =

    • I_BACKGROUND_ID = ' '

    • I_GRID_TITLE =

    • I_GRID_SETTINGS =

    • IS_LAYOUT =

    IT_FIELDCAT = it_fieldcat

    • IT_EXCLUDING =

    • IT_SPECIAL_GROUPS =

    IT_SORT = it_sortcat

    • IT_FILTER =

    • IS_SEL_HIDE =

    • I_DEFAULT = 'X'

    • I_SAVE = ' '

    • IS_VARIANT =

    • 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 = it_salesorder

    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. " display_data

    &----


    *& Form fetch_data

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    form fetch_data .

    select a~vbeln

    posnr

    b~netwr

    from vbak as a

    inner join vbap as b on avbeln = bvbeln

    into table it_salesorder

    where a~vbeln in s_vbeln.

    endform. " fetch_data

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.