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

SUM

Former Member
0 Likes
986

I want to print sum of all amount , i have 3 fields i want to sum them at the bottom of the report.these 3 fields are in a internal table.

how do i do?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
959

Hi,

LOOP AT itab.

AT LAST.

SUM.

WRITE : itab-field1, itab-field2....

ENDAT.

Thanks and Best Regards,

Vikas Bittera.

**Reward if useful**

11 REPLIES 11
Read only

Former Member
0 Likes
960

Hi,

LOOP AT itab.

AT LAST.

SUM.

WRITE : itab-field1, itab-field2....

ENDAT.

Thanks and Best Regards,

Vikas Bittera.

**Reward if useful**

Read only

0 Likes
959

hi vikas

thanks for giving me solution

after writing this code there is another errror occurs

in debug mode SUm is occurring but in my output its overlapping the 2nd field value and does display the sum of result

regards soumendra

Read only

0 Likes
959

hi vikas

thanks for giving me solution

after writing this code there is another errror occurs

in debug mode SUm is occurring but in my output its overlapping the 2nd field value and does not display the sum of result

regards soumendra

Read only

0 Likes
959

Hi Sumendra,

You need to adjust the WRITE statement..

Just give the positions too..

WRITE 😕 itab-field1,

20 itab-field2,

35 itab field3.

Adjust the values 20, 35 to display your o/p properly..

Thanks and Best Regards,

Vikas Bittera.

**Reward if useful**

Read only

0 Likes
959

hi vikas

still the prblm comes

Read only

0 Likes
959

hi vikas

shall i copy my code and screen shot of my o/t send to u

Read only

0 Likes
959

plz send me urmail id

Read only

0 Likes
959

Hi ..

If you paste ur Code.. i can trace the probelm..

regards,

Varma@infyTree.

Read only

0 Likes
959

Hi,

vikas.bittera@gmail.com

Thanks and Best Regards,

Vikas Bittera.

**Reward if useful**

Read only

Former Member
0 Likes
959

hi,

check this samole code

data : l_cust like kna1.

data: l_sales like vbak occurs 0 with header line.

  • vbeln type vbak-vbeln,

  • erdat type vbak-erdat,

  • netwr type vbak-netwr,

  • end of l_sales.

data amt_sum like vbak-netwr value 0.

parameters : cno like kna1-kunnr.

select single * from kna1 into corresponding fields of l_cust where kunnr = cno.

select *

from vbak into corresponding fields of table l_sales where kunnr = cno.

loop at l_sales.

amt_sum = amt_sum + l_sales-netwr.

endloop.

Read only

Former Member
0 Likes
959

Hi Soumendra,

I am not getting the issue.. wht do u mean by overlapping with field 2??

can you copy and paste the o/p?

Thanks and Best Regards,

Vikas Bittera.

**Reward if useful**