Skip to Content
0
Former Member
May 12, 2008 at 04:15 PM

totals for the internal table field in alv

21 Views

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