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

Help needed in formulating the logic!!

Himayatullah
Active Participant
0 Likes
881

Hi experts,

I have a requirement something like this. In CFM module we have some deals created.

For each deal there will be deal start date and end date.

Based on the user given input date I need to capture intrest accumlated till that date. Thats ok. But the problem is in between there can be repayments done.

For example : say deal number is 2004010155

start date : 4/1/2008

end date : 3/31/2009

basic amount : 8,00,000.

say suppose on 30.06.2008 a partial repayment of 1,00,000 done.

Now if user given date is 31.07.2008,then we need to calculate intrest amount with basic amount as 8,00,000 till 30.06.2008 and

starting from 01.07.2008 to 31.07.2008(user given date) I need to calculate intrest with amount 7,00,000.(After deducting one lakh as partial repayment done during this period).

For refernce table name is VTBFHAPO.

How can we achieve this?

Thanks & Regards

Himayat.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
836

Hi Himayathulla ,

you can achieve the mentioned requirement in the following way.

we have many function modules which will give dates between the given date range.

For example here i am taking FM 'DAY_ATTRIBUTES_GET'.

If i have passed data range 01.01.2009 to 31.12.2009 , All the dates between the date range captured in the Export table DAY_ATTRIBUTES of FM.

you can just read the export table , if the partial payment is there for a date 03.06.2009 then

Loop at IT_PARTIAL_PAY.

read table DAY_ATTRIBUTES where DATE  = IT_PARTIAL_PAY-DATE.
if sy-subrc is initial.

"Amount Deduction Logic here
" Update your amount in IT_PARTIAL_PAY , so that you can refer later.

Endif.

Endloop.

Hi experts,

I have a requirement something like this. In CFM module we have some deals created.

For each deal there will be deal start date and end date.

Based on the user given input date I need to capture intrest accumlated till that date. Thats ok. But the problem is in between there can be repayments done.

For example : say deal number is 2004010155

start date : 4/1/2008

end date : 3/31/2009

basic amount : 8,00,000.

say suppose on 30.06.2008 a partial repayment of 1,00,000 done.

Now if user given date is 31.07.2008,then we need to calculate intrest amount with basic amount as 8,00,000 till 30.06.2008 and

starting from 01.07.2008 to 31.07.2008(user given date) I need to calculate intrest with amount 7,00,000.(After deducting one lakh as partial repayment done during this period).

For refernce table name is VTBFHAPO.

How can we achieve this?

Thanks & Regards

Himayat.

6 REPLIES 6
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
836

Hello Himayat,

Can you please post the data available in VTBFHAPO specific to this scenario?

BR,

Suhas

Read only

0 Likes
836

HI Suhas,

There are multiple entries present in vtbfhapo for this deal. How to attach as an attachment?

Read only

0 Likes
836

Any idea?

Read only

Former Member
0 Likes
837

Hi Himayathulla ,

you can achieve the mentioned requirement in the following way.

we have many function modules which will give dates between the given date range.

For example here i am taking FM 'DAY_ATTRIBUTES_GET'.

If i have passed data range 01.01.2009 to 31.12.2009 , All the dates between the date range captured in the Export table DAY_ATTRIBUTES of FM.

you can just read the export table , if the partial payment is there for a date 03.06.2009 then

Loop at IT_PARTIAL_PAY.

read table DAY_ATTRIBUTES where DATE  = IT_PARTIAL_PAY-DATE.
if sy-subrc is initial.

"Amount Deduction Logic here
" Update your amount in IT_PARTIAL_PAY , so that you can refer later.

Endif.

Endloop.

Read only

Former Member
0 Likes
836

Hi Himayatullah,

Could you provide some more information such as how the deals are stored?

How the dates and Repayment information are stored?

It might be more feasible to come to an efficient solution if we have a better picture on the dictionary structures or internal tables used.

Thanks,

Mz

Read only

0 Likes
836

Hi,

Currently this how am trying to do. Partial repayment not taken into consideration yet. Its for calcualting intrest amt based on linear method or exponential method.

READ TABLE i_vtbfhazu.
          IF sy-subrc = 0.
            i_final-dblfz = i_vtbfhazu-dblfz.
            i_final-delfz = i_vtbfhazu-delfz.
          ENDIF.
          IF p_datum = i_final-delfz.
            i_final-int_per = ( p_datum - i_final-dblfz ) .
          ELSEIF  p_datum < i_final-delfz.
            i_final-int_per = ( p_datum - i_final-dblfz ) + 1.
          ELSEIF p_datum > i_final-delfz.
            i_final-int_per = ( i_final-delfz - i_final-dblfz ) + 1.
          ENDIF.

          READ TABLE ivtbfhapo1 WITH KEY rfha = i_vtbfhazu-rfha
                                      rfhazu = '1'
                                      rfhazb = '1' BINARY SEARCH.
          IF sy-subrc = 0.
            g_bzbetr = ivtbfhapo1-bzbetr.
            i_final-bzbetr = g_bzbetr.
          ENDIF.

          READ TABLE ivtbfhapo WITH KEY rfha = i_vtbfhazu-rfha
*                              szbmeth = '3'
                                rkond   = '1000' BINARY SEARCH.
          IF sy-subrc = 0.
            i_final-pkond = ivtbfhapo-pkond.
            CLEAR : g_int_amt, g_wtd_prn.

            READ TABLE ivtbfhapo2 WITH KEY rfha = i_vtbfhazu-rfha
                                           jexpozins = 'X' .
            IF sy-subrc = 0 .
              CASE ivtbfhapo2-ammrhyzv.
                WHEN '00'. g_var = 1.
                WHEN '06'. g_var = 2.
                WHEN '03'. g_var = 4.
                WHEN '01'. g_var = 12.
                WHEN '52'. g_var = 52.
                WHEN OTHERS. g_var = 1.
              ENDCASE.

              g_int_amt =  i_final-bzbetr * ( 1 +  i_final-pkond  /
                 ( g_var * 100 ) )  ** ( i_final-int_per * ( g_var  /
                    ivtbfhapo2-abastage ) ).

              g_int_amt = g_int_amt - i_final-bzbetr.
              i_final-int_amt = g_int_amt.
            ELSE.
              LOOP AT ivtbfhapo2 WHERE rfha = i_vtbfhazu-rfha
                                  AND abastage > '000000'.
                g_int_amt = i_final-bzbetr * ( i_final-pkond / 100 ) * (
                       i_final-int_per / ivtbfhapo2-abastage ).
                i_final-int_amt = g_int_amt.
              ENDLOOP.
            ENDIF.
            g_wtd_prn = i_final-bzbetr * i_final-int_per.
            i_final-wtd_prn = g_wtd_prn.

            APPEND i_final.

Thanks & Regards

Himayat