Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Internal tables.

Former Member
0 Kudos

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 &regards,

PB

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

4 REPLIES 4

Former Member
0 Kudos

Cna u explain u r requirement clerly so that i can send u the code

0 Kudos

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.

Former Member
0 Kudos

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.

Former Member
0 Kudos

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