09-26-2005 2:46 PM
hai,
How to sum the different numeric fields like eno,esal and dno for a table EMP between eno= 51 to 57 of 100 records.
Please provide the code for this.
regards,
bhargav.
09-26-2005 3:03 PM
Hi,
to avoid a dump you can try sth like this:
DATA pval TYPE p DECIMALS 0.
data cval(8).
DATA n TYPE n.
DATA i TYPE i.
CATCH SYSTEM-EXCEPTIONS conversion_errors = 1.
MOVE cval TO pval.
ENDCATCH.
if sy-subrc = 0.
sum = cval + n + i.
endif.
Andreas
09-26-2005 3:06 PM
hai,
I think ur solution is very typical one i cant get your solution.
please explain it clearly as iam new to abap.
09-26-2005 3:15 PM
hi,
let us assume all the values in the internal table.
in the loop we get get values one by one then we need to check if the eno is greter than 50 and less than 57 you do the sum and keep it into separate variable, that's it.
cheers,
sasi
09-26-2005 3:05 PM
hi,
loop at itab_emp.
if itab_emp-eno ge 51 and itab_emp-eno le 57
esal = esal + itab_emp-esal.
endif
endloop.
is this you want.
sasi
09-26-2005 3:11 PM
You can use
sort itab by empno.
Loop at itab where empno ge '51'
and empno le '57' .
<You adding logic here >.
Endloop.
Cheers