Skip to Content
0
Former Member
Jun 04, 2008 at 10:27 PM

Adding data in char fields of internal table together

39 Views

Hello,

I have an internal table with several fields in it including 2 character fields that contain amounts in them - F_OLD and F_NEW. I need to be able to add up the data in F_OLD and put it into a variable (I_OLD) and add up the data in F_NEW and put it into a variable (I_NEW). See an example of the data in the internal table here:

F_OLD and F_NEW are CHAR 254.

Record 1:

CHANGENR 2520026

TABKEY 010920000008300010

F_OLD 100

F_NEW 200

Record 2:

CHANGENR 2520026

TABKEY 010920000008300020

F_OLD 80

F_NEW 150

I want to have I_OLD = 100 + 80 and I_NEW = 200 + 150.

I don't think I can use COLLECT because not all the non-numeric fields will be the same. I don't think I can use SUM because it can only be used with numeric data types, and my data type here is CHAR.

Thanks in advance for your help,

Angela