06-17-2008 4:26 AM
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?
06-17-2008 4:49 AM
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.