Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9129

Re: Depreciation Key that depreciates once a year on February

$
0
0

Hi Luis GC,

      I have to migrate old User exits to BADI FAA_EE _CUSTOMER for custom depreciation calculation . I am able to get the Ordinary depreciation, but could not get Interest calculated .

      We have custom rate for interest calculation and so I have to get the details from FAA_DC_CUSTOMER >MO_BASIC data based on the Plant and Asset and get the rates from custom table and pass it to FAA_AA_CUSTOMER.

     I was able to calculate dbase values and calculation shows up fine in AFAR for Ordinary Depreciation . However Interest is not calculated properly with the rated which i am passing to  cs_calcdata-percent.

 

Custom Code:

METHOD if_ex_faa_ee_customer~set_percent_amount.

* Determination of depreciation percentage rate and amount due

* to methods ZA(Custom percentage rate depending on value type

* depreciation/interest), Z (explicit depreciation amount)..

 

     DATA:   l_afabtr   TYPE f,

             l_interest TYPE f,

             interest_c TYPE f,

             n_amount   TYPE f,

             l_legeb    TYPE f.

     DATA:   k_anlc             TYPE anlc,

             h_factor(16)       TYPE p DECIMALS 9,

             h_ndjar            TYPE p DECIMALS 3,

             v_aktiv            TYPE anla-aktiv,

             v_leanz            TYPE anlb-ndjar,

             v_date             TYPE d,

             lv_months_new      TYPE char05,

             lv_months_left     TYPE char02,

             lv_months_left_fin TYPE char02,

             lv_fin_yr          TYPE char04,

             h_afabg            TYPE anlc-gjahr,

             h_irate(16)        TYPE p DECIMALS 9,

             h_lzins            TYPE ants-lzins,

             h_paymnt           TYPE f,

             h_aquisi           TYPE f,

             c_value            TYPE f.

     DATA lt_ztable TYPE STANDARD TABLE OF ztable,

             ls_ztableTYPE ztable.

 

     h_irate    = 0.

     h_lzins    = 0.

     h_factor   = 0.

*    e_aktiv    = 'X'.

     l_interest = 0.

 

     FIELD-SYMBOLS<ls_segment>   TYPE faa_ee_s_segment,

                     <ls_parameter> TYPE faa_ee_s_parameter,

                     <ls_calcdata>  TYPE faa_ee_s_calcdata.

     FIELD-SYMBOLS<t_parameter>  TYPE faa_ee_t_parameter.

     DATAs_parameter  TYPE faa_ee_s_parameter.

 

     DATA: ld_percent     TYPE faa_ee_s_calcdata-percent,

           ld_amount      TYPE faa_ee_s_calcdata-amount,

           ld_amount_prev TYPE faa_ee_s_calcdata-amount.

 

     ASSIGN: isx_cdata-s_segment           TO <ls_segment>.

 

     ASSIGN: <ls_segment>-ref_parameter->* TO <ls_parameter>,

             <ls_segment>-ref_calcdata->TO <ls_calcdata>.

 

     ASSIGN: isx_idata-t_parameter TO <t_parameter>.

 

     CHECK<ls_parameter>  IS ASSIGNED,

             <ls_calcdata>   IS ASSIGNED,

             <t_parameter>   IS ASSIGNED.

 

     CLEAR: s_parameter.

     READ TABLE <t_parameter> INTO s_parameter

                              WITH KEY   area        = '05'

                                         amount_type = 'Z'

                                         baseval_key = 'ZA'

                                         percent_key = 'Y'.

     IF sy-subrc = 0.

       h_lzins     = s_parameter-minval_percent.

       ld_percent  = s_parameter-minval_percent / 100.

*    h_factor    = s_parameter-baseval_factor.

       h_factor    = s_parameter-minval_perc_add.

       l_interest  = <ls_calcdata>-basevalue * h_lzins / 100.

*    n_amount    = abs( <ls_calcdata>-basevalue ) -  abs( l_interest ).

 

       h_aquisi = <ls_calcdata>-basevalue.

       h_paymnt = h_aquisi * h_factor.

       c_value   = h_paymnt - l_interest.

     ENDIF.

** Interest Rate calculation ..

     CASE <ls_parameter>-baseval_key.

       WHEN 'ZA'.

*     calculation with stated percentage

*        h_irate = 0.

*        h_irate =  h_lzins / 100.

*        COMPUTE h_factor = 1 / ( ( 1 / h_irate ) - ( 1 / ( h_irate *

*                               ( ( 1 + h_irate ) ** h_ndjar ) ) ) ).

        

** setting output data: AMOUNT, AMOUNT_PREV, PERCENT in 'calcdata'

         cs_calcdata-amount          = c_value.

         cs_calcdata-amount_prev     = <ls_calcdata>-basevalue.

 

     ENDCASE.

     CASE <ls_parameter>-percent_key.

       WHEN 'X'.

         cs_calcdata-amount          = c_value.

         cs_calcdata-amount_prev     = <ls_calcdata>-basevalue.

         cs_calcdata-percent     = ld_percent.

       WHEN 'Y'.

         cs_calcdata-amount          = c_value.

         cs_calcdata-amount_prev     = <ls_calcdata>-basevalue.

         cs_calcdata-percent     = ld_percent.

       WHEN 'Z'.

 

     ENDCASE.

ENDMETHOD.


Problem:

Here I am passing ld_percent is around 5%, but not calculation based on the base value. say cs_calcdata-amount_prev is 100, I am supposed to get interest of 5$  for 5% which is not the case. Please help.


Appreciate for the time and pls help. Thanks


Viswanadha C


Viewing all articles
Browse latest Browse all 9129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>