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

subtotal and grand total for two fields(iseg-buchm and iseg-erfmg)

hi experts,

how to do subtotal and grand total for two fields (iseg-buchm and iseg-erfmg).please help me on solving the problem.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jun 19, 2008 at 04:10 AM

    Hi,

    If you want to display these 2 fields get them in internal table and fill the field catalog properly.For grand total give DO_SUM = 'X'. in field catalog.In the layout define an internal table for sorting.Pass this parameter.

    wa_sort-spos = 1.

    wa_sort-up = 'X'.

    wa_sort-subtot = 'X'.

    Call FM REUSE_ALV_GRID_DISPLAY to display report.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 19, 2008 at 04:13 AM

    hi,

    data: it_sort TYPE slis_t_sortinfo_alv,

    wa_sort TYPE slis_sortinfo_alv.

    for sub total :

    wa_sort-fieldname = 'BUCHM'.

    wa_sort-tabname = 'IT_ISEG'.

    wa_sort-subtot = 'X'.

    APPEND wa_sort TO it_sort.

    CLEAR wa_sort.

    for grand total: in field catlog pass DO_SUM = 'X'.

    wa_fieldcat1-fieldname = 'ERFMG'.

    wa_fieldcat1-do_sum = 'X'.

    thanks,

    raji

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 19, 2008 at 04:13 AM

    subtotal & grand total can be done in folowing way in ALV.

    1.Pass it_sort parametere to REUSE_ALV_GRID_DISPLAY

    2.Give the field name for sorting in it_sort-fieldname. it can be any field name u want to sort ur data with.

    3.For iseg-buchm & iseg-erfmg mark do_sum = 'X'. in fieldcat

     
      gs_sort-spos = 1.
      gs_sort-fieldname = 'ANY FIELD NAME'.
      gs_sort-up = 'X'.
      gs_sort-subtot = 'X'.
      APPEND gs_sort TO et_sort.
    
      IF iv_fieldname = 'BUCHM'
      OR iv_fieldname = 'ERFMG'.
        gs_fieldcat-do_sum = 'X'.
      ENDIF.
      APPEND gs_fieldcat TO gt_fieldcat.
    
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
           is_variant              = ev_variant
          it_fieldcat             = gt_fieldcat[]
    
    

    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.