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: 

Sum of all the values in a field

Former Member
0 Kudos

I have a report which needs to sum all the values of KONV-KBETR where KONV-kinak NE 'A'.

How do i write the code.

Can anyone help me in wrting the code..

This value i have to finally display in my internal table as one value.

7 REPLIES 7

Former Member
0 Kudos

HI,

Check the below code...

IF konv-kinak NE 'A'.

v_kbetr = konv-kbetr + v_kbetr.

ENDIF.

Cheers,

Bujji

0 Kudos

Bujji..

But the value v_kbetr is not constant..

And morever i dont know what the values are there in the field konv-kbetr.

could you help me further.

0 Kudos

Hi Mona,

slight change..

data:w_kbetr type konv-kbetr.

loop at konv.

if konv-... ne 'A'.

W_kbetr = w_kbetr + konv-kbetr.

endif.

endloop.

i hope this wil help u...

Regards,

Kaveri

0 Kudos

Hey Kaveri..

Thanks.

I think that should work..

0 Kudos

Hi Mona,

I think you forgot to allocate marks )))))))))

Regards,

Kaveri

Former Member
0 Kudos

data: sumf type i.

select sum( kbetr ) from konv into sumf where kinak <> 'A' group by konv.

write: sumf.

Message was edited by:

Ramu

0 Kudos

within a IF statement you can use a collect statement