Application Development and Automation 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: 
Read only

itab sum

Former Member
0 Likes
607

hi,

i have amount field in itab.

i want sum and pass it to a variable.

shall i do like this.

loop at gt_item into wa_item.

SUM .

sumtotal = sumtotal + wa_item-wrbtr .

endloop.

thanks

Santosini

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
588

Hi,

In your code, you need to have sum. Refer below code:


loop at gt_item into wa_item.
   sumtotal = sumtotal + wa_item-wrbtr .
endloop.

write : sumtotal.

Thanks,

Sriram Ponna.

5 REPLIES 5
Read only

Former Member
0 Likes
588

The best way to learn is to try it for yourself and see what result you get.

Read only

Former Member
0 Likes
589

Hi,

In your code, you need to have sum. Refer below code:


loop at gt_item into wa_item.
   sumtotal = sumtotal + wa_item-wrbtr .
endloop.

write : sumtotal.

Thanks,

Sriram Ponna.

Read only

anversha_s
Active Contributor
0 Likes
588

Hi,

Pls find the code.

data : sumtotal like wa_item-wrbtr.

clear sumtotal.

loop at gt_item into wa_item.

sumtotal = sumtotal + wa_item-wrbtr .

clear wa_item.

endloop.

write sumtotal.

Rgds

Anversha

Read only

Nawanandana
Active Contributor
0 Likes
588

hi

yes but small mistake..... u hv to remove SUM

loop at gt_item into wa_item.

sumtotal = sumtotal + wa_item-wrbtr .

endloop.

cheers

nawa

Read only

Former Member
0 Likes
588

Hi,

loop at gt_item into wa_item.
at end of belnr.
SUM .
sumtotal = sumtotal + wa_item-wrbtr .
endat
endloop.

Regards,

Ballack.

Reward Points if helpful.