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

Totals Calculation

Former Member
0 Likes
1,075

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

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
Read only

Former Member
0 Likes
1,045

>

> 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?

Read only

0 Likes
1,045

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

Read only

Former Member
0 Likes
1,045

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

Read only

0 Likes
1,045

Hi,

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

Regards,

Srik

Read only

0 Likes
1,045

Srik,

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

You need to fit the requirement

//Kothand

Read only

Former Member
0 Likes
1,045

This message was moderated.

Read only

Former Member
0 Likes
1,045

Hi,

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

Regards,

Srik

Read only

0 Likes
1,045

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?

Read only

former_member125931
Active Participant
0 Likes
1,045

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.*

Read only

Former Member
0 Likes
1,045

thank u