Former Member

# need logic to get the due amount in 0 to 30 days 31 to 60 days and so on.

Hi Experts,

I have the due date, base line date, and payment terms AND DUE AMOUNT of each year. also I have defined a field as DUER.

if the amount falls with in 0 to30 days then DUER = 1.

31 to 60 days then DUER = 2 and so on.

Now My problem is how to proceed to calcualte the amount is due or over due as 0 to 30 days or 31 to 60 days 60 to 90 days 91 to 120 days.

For this I have defined a field like AGEING.

I am claculating the ageing = keydate - due dat.

Now my problem is how to separate the amount into due and over due as well as with in the days i have defined.

Here the section of code I am using, through this I got the due amount of each fiscal year.

SORT IT_BSEG BY GJAHR DUER1.

LOOP AT IT_BSEG INTO WA_BSEG.

AT END OF GJAHR.

SUM.

LOOP AT IT_ITAB INTO WA_ITAB WHERE GJAHR = WA_BSEG-GJAHR.

WA_ITAB-PRICE = WA_BSEG-DUE_AMT.

MODIFY IT_ITAB FROM WA_ITAB TRANSPORTING PRICE SPART.

clear wa_itab.

ENDLOOP.

ENDAT.

ENDLOOP.

to get the due amount for 0 to 30 days and 31 to 60 days and so on I am using this code. But unable toget the desired result.

ON CHANGE OF WA_BSEG-DUER1. " DUER1 is to chekc whether the amount is over due , if its over due then when it falls ( 0 to 30 days , 31 to 60 dyas and so on)

SUM.

WA_ITAB-PRICE = WA_BSEG-DUE_AMT.

ENDON.

##### Add a comment
10|10000 characters needed characters exceeded

### Related questions

• Posted on Oct 25, 2010 at 02:54 PM

There are several standard due date analysis reports in the system - you may want to have a look at those. As for proper aging logic for your scenario, it depends on your business processes and how credits are matched against debits and cleared. In the simplest scenario, it is fairly easy to find all open debits for an account, calculate the age of each debit, then consume those debits with the existing open credits on the account. You can wind up with multiple balances by age or a single balance - just set up your age 'buckets' and then use loop processing on your open items to calculate what falls in each bucket.

##### Add a comment
10|10000 characters needed characters exceeded
• Former Member Former Member

Hi Sumit,

I have the due amount for one financial year which is calculated cumulatively by adding each VBELN's due amount and checked the total amount in VBRK and compared how much paid by the customer which is stored in BSEG-DMBTR.

After comparing with VBRK-NETWR and + Tax from VBRK then Deducted from BDEG-DMBTR.

After that I sorted the it_bseg.

and this is the code to get the total amount in each financial year.

SORT IT_BSEG BY GJAHR DUER1.

LOOP AT IT_BSEG INTO WA_BSEG.

AT END OF GJAHR.

SUM.

LOOP AT IT_ITAB INTO WA_ITAB WHERE GJAHR = WA_BSEG-GJAHR.

WA_ITAB-PRICE = WA_BSEG-DUE_AMT.

MODIFY IT_ITAB FROM WA_ITAB TRANSPORTING PRICE SPART.

clear wa_itab.

ENDLOOP.

ENDAT.

ENDLOOP.

Now I have to calculate the amount of 0 to 30 days and 31 to 60 days and so on.

I tried with ONCHANGE OF WA_BSEG-DUER1. bnut its not working.

this 0 to 30 days and so on i have to calculate for the current financail year and just previous financial year( like 2010 and 2009) only not less than this.