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: 

Totals Calculation

Former Member
0 Kudos

Hi Experts,

I have a requirement that:

I need to calculate the total for a particular field according to the individual years.

For Eg: Let the field name be 'Amount reimbursed' for the year 2007 from a particular Ztable, we need to calculate the total amount and later need to check whether the value is less than $5000.

Regards,

Srikanth

10 REPLIES 10

Former Member
0 Kudos

>

> Hi Experts,

>

> I have a requirement that:

> I need to calculate the total for a particular field according to the individual years.

>

> For Eg: Let the field name be 'Amount reimbursed' for the year 2007 from a particular Ztable, we need to calculate the total amount and later need to check whether the value is less than $5000.

>

> Regards,

> Srikanth

That's nice - sounds interesting.

Do you have a specific question?

0 Kudos

Hi,

That itseld is my requirement. I created a custom infotype and I need to insert a field call Total and this contains the total of the fee reimburesed.

Regards,

Srik

Former Member
0 Kudos

Hi Srik,

try this

SELECT SUM( amount field )

into lv_total_amount

from ztable

where year field = '2007'.

if lv_total_amount > 5000.

*do the processing

endif.

//Kothand

0 Kudos

Hi,

I just gave 2007 as an example but actually it should work for the future years aswell.

Regards,

Srik

0 Kudos

Srik,

I just gae you the idea SUM is used for calculating total even throught SELECT statement.

You need to fit the requirement

//Kothand

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

Hi,

The requirement above is w.r.t to custom infotype. Please help me out.

Regards,

Srik

0 Kudos

Srik,

You've already been given some suggestions on how to do this - what more do you want? Do you want someone else to write the code for you?

former_member125931
Active Participant
0 Kudos

Try like this.

*sort itab ascending by yearfield .

loop at itab into wa.

at yearfield.

endat.

sum = sum + wa-amountfield.

at END OF yearfield.

endat.

ENDLOOP.*

Former Member
0 Kudos

thank u