02-11-2008 6:42 AM
Hi Experts,
I have one internal table with 6 fields.(client ID, date and amount so on....)
in internal table i have the data in 5 rows in 6 th row total of the amount field.(below the amount column)
Now my requirement is, check total amount with sum of amount field data.
Please give the code for the same.
thanks ®ards,
PB
02-11-2008 6:56 AM
Hi,
DESCRIBE TABLE internal table LINES lin --- with this you will get the number of rows in the field lin.
Loop at internal table.
v_flag = v_flag + 1.
v_flag_total = v_flag_total + amountfield.
if v_flag eq lin.
check v_flag_total eq the total amount field in the 6th row.
endif.
endo.
Note:my yahoo id is dina_karan10@yahoo.com
Get in touch if you still find the issue.
Regards,
Dinakaran.R
02-11-2008 6:50 AM
Cna u explain u r requirement clerly so that i can send u the code
02-11-2008 6:56 AM
it_itab.
field1 feield2 field3 - -- ---
1425 11/02/08 3,500
1426 11/02/08 2,500
1427 11/02/08 5,500
1428 11/02/08 6,500
1429 11/02/08 1,500
total 10,000.
now i want to check total is equal to sum of field3.
that mens check 10,000 eq sum of field3.
please give the code.
thanks
PB.
02-11-2008 6:53 AM
Hi PB,
Try this,
data: sum type i , (or the type of amount )
count type i.
Loop at itab.
sum = itab-amount + sum.
if sy-index eq 5.
exit.
endif.
endloop.
read table itab index 6.
if sum ne itab-amount.
write / 'Not similar'.
endif.
Plzz reward if it is useful,
Mahi.
02-11-2008 6:56 AM
Hi,
DESCRIBE TABLE internal table LINES lin --- with this you will get the number of rows in the field lin.
Loop at internal table.
v_flag = v_flag + 1.
v_flag_total = v_flag_total + amountfield.
if v_flag eq lin.
check v_flag_total eq the total amount field in the 6th row.
endif.
endo.
Note:my yahoo id is dina_karan10@yahoo.com
Get in touch if you still find the issue.
Regards,
Dinakaran.R