Skip to Content
0
Former Member
Feb 12, 2010 at 04:09 PM

SUM a field content of an internal table

19 Views

Hi,

I've an internal table (ITBL) and at end i need to group (SUM) content of a field (NETWR)

ID KUNNR BUKRS VKORG NAME NETWR

281 0000010184 FARB FARB FARMÁCIA CENTRAL 442.29

282 0000010184 FARB COFA FARMÁCIA CENTRAL 100.00

283 0000010184 FARB FEIR FARMÁCIA CENTRAL 0.00

i've this code

LOOP AT itbl INTO ls_itbl.

l_netwr = l_netwr + ls_itbl-netwr.

AT END OF kunnr.

itbl-netwr = l_netwr.

LOOP AT itbl WHERE kunnr = ls_itbl-kunnr.

MODIFY itbl INDEX sy-tabix TRANSPORTING netwr.

ENDLOOP.

CLEAR l_netwr.

ENDAT.

ENDLOOP.

and i want final result

ID KUNNR BUKRS VKORG NAME NETWR

281 0000010184 FARB FARB FARMÁCIA CENTRAL 542.29

282 0000010184 FARB COFA FARMÁCIA CENTRAL 542.29

283 0000010184 FARB FEIR FARMÁCIA CENTRAL 542.29

Can somebody tell me what i've wrong ?

Thanks

Edited by: Ricardo Filipe Pimenta on Feb 12, 2010 5:09 PM