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

Sub Total in ALV

Dear all,

Suppose I have the following data in an internal table:

Inv No.     Date        Customer   Pack  Load No.  Tax Amt
9000000001  01.01.2007  ABCABCABC    24  1190020    100000
9000000001  01.01.2007  ABCABCABC    24  1190021    100000
9000000001  01.01.2007  ABCABCABC    24  1190031    100000
9000000002  11.01.2007  ABCABCABC    35  1190881    300000
9000000002  11.01.2007  ABCABCABC    35  1190882    300000
9000000002  11.01.2007  ABCABCABC    36  1190991    300000
9000000002  11.01.2007  ABCABCABC    36  1190992    300000
9000000002  11.01.2007  ABCABCABC    36  1190993    300000

How do I make the list look like below in ALV. I'm using FM REUSE_ALV_GRID_DISPLAY.

Inv No.     Date        Customer   Pack  Load No.  Tax Amt
9000000001  01.01.2007  ABCABCABC    24  1190020    100000
                                         1190021          
                                         1190031          
Subtotal                             24             100000
9000000002  11.01.2007  ABCABCABC    35  1190881    300000
                                         1190882          
                                     36  1190991          
                                         1190992          
                                         1190993          
Subtotal                             71             300000

Thanks in advance.

Regards,

Goh Tiam Tjai

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Dec 05, 2007 at 02:21 AM

    Set the DO_SUM for the field PACK and TAX_AMT in the your fieldcatalog.

    Now you need to pass the SORT table.

      DATA: ls_sort TYPE slis_sortinfo_alv.
    data: xt_sort TYPE slis_t_sortinfo_alv.
    
      ls_sort-fieldname = 'INV_NO'.
      ls_sort-spos = 1.
      ls_sort-up = 'X'.
      ls_sort-subtot = 'X'.
      APPEND ls_sort TO xt_sort.
      CLEAR ls_sort.
    
      ls_sort-fieldname = 'DATE'.
      ls_sort-spos = 2.
      ls_sort-up = 'X'.
      ls_sort-subtot = 'X'.
      APPEND ls_sort TO xt_sort.
      CLEAR ls_sort.
    
      ls_sort-fieldname = 'CUSTOMER'.
      ls_sort-spos = 3.
      ls_sort-up = 'X'.
      ls_sort-subtot = 'X'.
      APPEND ls_sort TO xt_sort.
      CLEAR ls_sort.

    Pass this SORT table into your FM:

      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program      = l_repid
          i_callback_top_of_page  = c_formname_top_of_page
          i_callback_user_command = c_user_command
          i_save                  = 'A'
          is_variant              = i_variant
          it_sort                 = t_sort " <<
    

    Regards,

    Naimesh Patel

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Naimesh,

      Thanks for the prompt response.

      That way will make PACK and TAX_AMT to be summed for every line. For PACK, it supposes to be summed only for new value in the lines and TAX_AMT should be only one line (first line) for each Invoice No.

      Any idea how I can do it?

      Regards,

      Goh Tiam Tjai

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.