HI ALL,

I have an internal table with 3 columns but the data here is duplicated and i m gonna add the camount which is at 3rd column. below is the code and the sum is not happening please help on this.

regards,

jithendra.

TYPES : BEGIN OF T_SUM,

CNO(4) TYPE C,

CNAME(20) TYPE C,

CAMOUNT(7) TYPE P DECIMALS 2 DECIMALS,

END OF T_SUM.

DATA : ITAB TYPE TABLE OF T_SUM,

WA TYPE T_SUM.

WA-CNO = 'C001'.

WA-CNAME = 'MIKE'

WA-CMOUNT = '2000'

APPEND WA TO ITAB.

WA-CNO = 'C002'.

WA-CNAME = 'JOHN'

WA-CMOUNT = '5000'

WA-CNO = 'C003'.

WA-CNAME = 'ARNOLD'

WA-CMOUNT = '6000'

WA-CMOUNT = '4000'

WA-CMOUNT = '7000'

SORT ITAB BY CNO ASSENDING.

LOOP AT ITAB INTO WA.

AT NEW CNO.

SUM.

ENDAT.

WRITE : / WA-CNO, WA-CNAME, WA-CAMOUNT.

ENDLOOP.

Hello Jithendra,

Make the following correction in your code to get the sum.

LOOP AT ITAB INTO WA. AT NEW CNO. SUM . WRITE : / WA-CNO, WA-CNAME, WA-CAMOUNT. ENDAT.

You already have an active moderator alert for this content.

## Add comment