Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

problem in report how to do grand total so that it will show grand total

Former Member
0 Kudos

hi expert ,

how to do subtotal and grand total and show it in whether it is in negative or positive value in report.please help me and send some example?

1 REPLY 1

Former Member
0 Kudos

Hi,

You can use the following code to do sub total and grand total.


*  ALV data declarations
  data: it_sortcat   type slis_sortinfo_alv occurs 1,
        wa_sort like line of it_sortcat.
 perform build_sortcat.

*&------------------------------------------------------------------*
*&      Form  build_sortcat
*&------------------------------------------------------------------*
*       Build Sort catalog
*-------------------------------------------------------------------*
FORM build_sortcat .
  wa_sort-spos      = 1.
  wa_sort-fieldname = 'EBELN'.
  wa_sort-SUBTOT    = 'X'. "subtotals any totals column by this field
*  gd_sortcat-tabname
  APPEND wa_sort TO it_sortcat.

  wa_sort-spos      = 2.
  wa_sort-fieldname = 'EBELP'.
*  gd_sortcat-tabname
  APPEND wa_sort TO it_sortcat.
ENDFORM.                    " build_sortcat

And pass it_sort to it_sort of ALV FM export parameters.

Thanks,

Sriram Ponna.