on 03-03-2017 2:36 AM
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'
APPEND WA TO ITAB.
WA-CNO = 'C003'.
WA-CNAME = 'ARNOLD'
WA-CMOUNT = '6000'
APPEND WA TO ITAB.
WA-CNO = 'C002'.
WA-CNAME = 'JOHN'
WA-CMOUNT = '6000'
APPEND WA TO ITAB.
WA-CNO = 'C001'.
WA-CNAME = 'MIKE'
WA-CMOUNT = '4000'
APPEND WA TO ITAB.
WA-CNO = 'C003'.
WA-CNAME = 'ARNOLD'
WA-CMOUNT = '7000'
APPEND WA TO ITAB.
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 must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.