11-14-2006 4:22 PM
hi all,
i need to calculate montly subtotal value of a field in ALV ( OO),
how can i do that.
plz send the code also.
thanks in advance.
regards
sushant singh
11-14-2006 4:32 PM
Hi Sushant,
try :
clear sort.
sort-fieldname = 'MATNR'.
sort-tabname = 'INTERNAL TABLE NAME'
sort-up = 'X'.
SORT-SUBTOT = 'X'.
append sort to t_sort.
clear sort.
Pass This t_sort ITAB in FM REUSE_ALV_GRID_DISPLAY as
it_sort = t_sort[]
Reward points if this helps.
Manish
11-14-2006 4:35 PM
Hi,
1) Create a sort internal table for you to do sub totaling based on the field change..In this example..I have created a sort internal table and it will sum for every change in the field VBELN.
data: gs_sort type lvc_s_sort.
data: gt_sort type lvc_t_sort.
gs_sort-fieldname = 'VBELN'.
gs_sort-UP = 'X'.
gs_sort-SUBTOT = 'X'.
append gs_sort to gt_sort.
Pass the internal table GT_SORT to the parameter
it_sort = gt_sort
of the method set_table_for_first_display..
2) For the field you have to do sum in the field catalog have the field DO_SUM = 'X'..
Thanks,
Naren