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

Regarding Sub taotal Text

hi all,

Please tell me the logic for

Displaying Total Text and subtotal text in ALV Grid display.

I will give Reward points if helpful.

Regards

Reddy

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2008 at 07:37 AM
    
    DATA: wa_layout TYPE slis_layout_alv, "Layout structure
    
    END-OF-SELECTION.
    
    PERFORM build_layout.
    
    FORM build_layout .
    wa_layout-ZEBRA = 'X'.
    wa_layout-NO_VLINE = 'X'.
    wa_layout-NO_HLINE = 'X'.
    wa_layout-CELL_MERGE = 'X'.
    wa_layout-EDIT = 'X'.
    wa_layout-WINDOW_TITLEBAR = ''.
    wa_layout-NO_ULINE_HS = 'X'.
    wa_layout-LIGHTS_FIELDNAME = ''.
    wa_layout-LIGHTS_TABNAME = ''.
    wa_layout-LIGHTS_ROLLNAME = ''.
    wa_layout-LIGHTS_CONDENSE = 'X'.
    wa_layout-NO_TOTALLINE = 'X'.
    wa_layout-NO_SUBTOTALS = 'X'.
    wa_layout-TOTALS_BEFORE_ITEMS = 'X'.
    wa_layout-TOTALS_ONLY = 'X'.
    wa_layout-TOTALS_TEXT = ''.
    wa_layout-SUBTOTALS_TEXT = ''.
    wa_layout-BOX_FIELDNAME = ''.
    wa_layout-BOX_TABNAME = ''.
    wa_layout-BOX_ROLLNAME = ''.
    wa_layout-CONFIRMATION_PROMPT = 'X'.
    wa_layout-HEADER_TEXT = ''.
    
    ENDFORM.
    
    
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING
    i_callback_program = gf_repid
    is_layout = gwa_layout
    it_fieldcat = gt_catalog
    
    TABLES
    t_outtab = gt_line
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    
    
    
    
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2008 at 07:41 AM

    Hi,

    Populate the Sort table for alv grid disply.

    In fieldcatalog maintain do_sum = 'X' for what are all the fields which you want the sum.

    while populating the sort table for ALV Grid, pass the key field based on that the sum should appear.

    e.g.

    data wa_inv_sort TYPE lvc_s_sort.

    data i_inv_sort TYPE lvc_t_sort.

    wa_inv_sort-fieldname = 'WERKS'.

    wa_inv_sort-up = c_x.

    APPEND wa_inv_sort TO i_inv_sort.

    CALL METHOD g_inv_grid->set_table_for_first_display

    EXPORTING

    is_layout = wa_inv_layo

    CHANGING

    it_outtab = i_final_data

    it_fieldcatalog = i_inv_fcat

    it_sort = i_inv_sort

    EXCEPTIONS

    invalid_parameter_combination = 1

    program_error = 2

    too_many_lines = 3

    OTHERS = 4.

    IF sy-subrc <> 0.

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

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

    ENDIF.

    Thanks,

    Rajinikanth G

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2008 at 07:56 AM

    dear friend,

    you have to maintain , fcat-do_sum = 'X'.

    for the total sum.

    the code should be like this.

    if any problem pls keep in touch.

    rewards are expecting.

    vivek

    answer:

    fcat-fieldname = 'ZBINV'.

    fcat-outputlen = 20.

    fcat-seltext_s = 'Amount'.

    fcat-seltext_m = 'Amount'.

    fcat-seltext_l = 'Amount'.

    fcat-ddictxt = 'M'.

    fcat-inttype = 'QUAN'.

    fcat-datatype = 'QUAN'.

    fcat-do_sum = 'X'.

    APPEND fcat.

    CLEAR fcat.

    fheader-typ = 'H'.

    fheader-info = 'EXPORT SALES REGISTER'.

    APPEND fheader.

    CLEAR fheader.

    ************************************************************************

    gd_layout-no_input = 'X'.

    gd_layout-colwidth_optimize = 'X'.

    gd_layout-totals_text = 'Totals'(601).

    gd_layout-totals_only = 'X'.

    • gd_layout-f2code = 'DISP'. "Sets fcode for when double

    • "click(press f2)

    gd_layout-zebra = 'X'.

    • gd_layout-group_change_edit = 'X'.

    • gd_layout-header_text = 'helllllo'.

    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

    EXPORTING

    i_list_type = 0

    IMPORTING

    et_events = fevents[]

    EXCEPTIONS

    list_type_wrong = 1

    OTHERS = 2.

    READ TABLE fevents WITH KEY name = 'TOP_OF_PAGE'.

    IF sy-subrc = 0.

    fevents-form = 'TOPOFPAGE'.

    MODIFY fevents INDEX sy-tabix.

    CLEAR fevents.

    ENDIF.

    rptname = sy-repid .

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    i_callback_program = rptname

    it_fieldcat = fcat[]

    i_default = 'S'

    it_events = fevents[]

    it_sort = it_sortcat

    is_print = gd_prntparams

    i_save = 'X'

    is_layout = gd_layout

    TABLES

    t_outtab = it_output[].

    • EXCEPTIONS

    • PROGRAM_ERROR = 1

    • OTHERS = 2

    ENDFORM . " alv_display .

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2008 at 07:58 AM
    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.