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

Split yearly amount into periods

Missschaaa
Participant
0 Likes
617

Hello guys,

is there any function which can split some inputed yearly amount into the 12 periods? Of course I can do this like calculate amount /12 but I have the problem with rounding. It can happen that the sum of the months amounts is bigger than the original inputed yearly amount. And I do not want to just add the difference to the last months. I prefer doing it like e.g. transaction CJR2 which puts e.g. the value 50000 EUR like:

01 4.166,67
02 4.166,66
03 4.166,67
04 4.166,67
05 4.166,66
06 4.166,67
07 4.166,67
08 4.166,66
09 4.166,67
10 4.166,67
11 4.166,66
12 4.166,67

How can I rebuild this?


Regards

Michael

Hello guys,

is there any function which can split some inputed yearly amount into the 12 periods? Of course I can do this like calculate amount /12 but I have the problem with rounding. It can happen that the sum of the months amounts is bigger than the original inputed yearly amount. And I do not want to just add the difference to the last months. I prefer doing it like e.g. transaction CJR2 which puts e.g. the value 50000 EUR like:

01 4.166,67
02 4.166,66
03 4.166,67
04 4.166,67
05 4.166,66
06 4.166,67
07 4.166,67
08 4.166,66
09 4.166,67
10 4.166,67
11 4.166,66
12 4.166,67

How can I rebuild this?


Regards

Michael

1 REPLY 1
Read only

RaymondGiuseppi
Active Contributor
557

In some DO/LOOP you memorize amount to split and number of record to generate

amount = total_amount. " work area
number = total_number.
WHILE number GT 0.
  IF number = 1. " last record, no rounding
    value = amount.
    CLEAR amount.
  ELSE.
    value = amount / number. " rounding allowed
    SUBTRACT value FROM amount.
  ENDIF.
  " save value somewhere
  SUBTRACT 1 FROM number.
ENDWHILE.