05-12-2008 5:15 PM
Hi Gurus,
I have an issue in displaying the totals in alv.
I have an internal table with the three fields like below.
scrap_code_001 like afru-xmnga, " Scrap Reason Qty.
scrap_code_002 like afru-xmnga, " Scrap Reason Qty.
scrap_code_003 like afru-xmnga, " Scrap Reason Qty.
In the output table which i am passing to the fieldcatlog is having the three above fields with values 10,3,4 respectively.
I am looping at the internal table
loop at gt_grund.
gv_tabix = sy-tabix.
i_fieldcat-no_zero = gc_x.
i_fieldcat-do_sum = gc_x.
perform assign_alv_qty_format.
if gt_grund-grund is initial.
gt_grund = 'NONE'.
gv_text = gt_grund.
else.
gv_text = gt_grund-grdtx.
endif.
gv_tabixn = gv_tabix.
gv_scrap_code+11(03) = gv_tabixn.
gv_fieldname = gv_scrap_code.
translate gv_fieldname to upper case.
perform bild_fieldcat using
gv_fieldname 'GT_REPORT' 'AFRU' gv_text 'QUAN' '12' ' ' .
endif.
endloop.
But in the output I am getting the totals but it displays totals for all the three columns as 17,17,17 (summing 10,3,4).
How do I display total as 10,3,4 for each column separately.
I appreciate you help and award points for the answer
05-12-2008 6:00 PM
Hi,
Please check if value fields i_fieldcat-ref_fieldname and i_fieldcat-ref_tabname regard to numc or curr type.
EX: i_fieldcat-ref_fieldname = 'WRBTR'
I_fieldcat-ref_tabname = 'BSEG'.
Regards,
Fernando
05-12-2008 5:23 PM
you shouldn't pass the output table to the fieldcatalog. You should let the system (ALV functionality) do the (sub)totals.
So just pass output table to ALV and in fieldcatalog tell which columns to sum.
I don't see any of this in the coding.
05-12-2008 5:26 PM
Hi,
Thanks for your reply.
I am passing
i_fieldcat-do_sum = gc_x.
in the beginning of the loop.
Thanks,
05-12-2008 6:00 PM
Hi,
Please check if value fields i_fieldcat-ref_fieldname and i_fieldcat-ref_tabname regard to numc or curr type.
EX: i_fieldcat-ref_fieldname = 'WRBTR'
I_fieldcat-ref_tabname = 'BSEG'.
Regards,
Fernando