07-21-2008 11:44 AM
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
07-21-2008 11:46 AM
>
> 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?
07-21-2008 11:49 AM
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
07-21-2008 11:48 AM
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
07-21-2008 11:50 AM
Hi,
I just gave 2007 as an example but actually it should work for the future years aswell.
Regards,
Srik
07-21-2008 11:55 AM
Srik,
I just gae you the idea SUM is used for calculating total even throught SELECT statement.
You need to fit the requirement
//Kothand
07-21-2008 11:49 AM
07-21-2008 12:25 PM
Hi,
The requirement above is w.r.t to custom infotype. Please help me out.
Regards,
Srik
07-21-2008 12:26 PM
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?
07-21-2008 1:16 PM
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.*
08-05-2008 3:25 PM