we have the following code in include ZXAFAU02.
It's working fine generally but if there are additional acquisitions, and other postings for the year, the computation becomes wrong. the depreciation doesn't get spread out correctly according to the remaining useful life.
Please advise how do we correct this.
Thanks very much.
DATA: lv_ul TYPE ndper, "useful life (month)
lv_ex_ul TYPE ndper, "expired useful life (month)
lv_balance TYPE ndper, "balance useful life (month)
lv_nbv LIKE anlc-kansw, "net book value of remaining life
lv_depreciation LIKE anlc-kansw, "depreciate value per month
lv_afblpe LIKE anlc-afblpe, "period of last posting
lv_months TYPE ndper. "remaining months (current run)
* check depreciation calculation method eq 'X'
CHECK i_afap-afamet EQ 'X'.
* calculate userful life in months
lv_ul = i_anlb-ndjar * 12 + i_anlb-ndper.
LOOP AT t_anlc WHERE afabe EQ i_afabe.
* calculate expired useful life, up to last posted month
lv_ex_ul = t_anlc-ndabj * 12 + t_anlc-ndabp + t_anlc-afblpe.
* calculate the NBV for the remaining useful life
lv_nbv = t_anlc-kansw + t_anlc-knafa + t_anlc-nafag.
* store last posting period
lv_afblpe = t_anlc-afblpe.
* balance useful life in months
lv_balance = lv_ul - lv_ex_ul.
* monthly depreciation - per remaining month of useful live
IF lv_balance GT 0.
lv_depreciation = lv_nbv / lv_balance.
lv_depreciation = 0.
* remaining months for current run (useful life)
lv_months = i_afap-rperend - i_afap-rperbeg + 1.
* reduce by already posted months
lv_months = lv_months - lv_afblpe.
* calculate total depreciation value for current period
e_afabtr = ( t_anlc-nafag * -1 ) + ( lv_depreciation * lv_months ).
* set active flag
e_aktiv = 'X'.
- What is User Exits?
- SAP User Exits and Enhancements
- Enhancements and User Exits
- Difference Between BADI and User Exits
- User exits in delivery processing
- What is User Exits and Customer Exits?
- SAP has provided around 2000 user exits.
- User Exits and BAdIs in the Variant Configuration
- User-exit for VA21
- User logoff exit ???
- User exit in mb1a
- Trigger User-Exit MWMTO007
- BADI/user exit for J1B1N
- User Exit For F-02
- User-exit CS01/CS02/CS03
- user-exit, field exit for transaction code PSOBWORK
- Difference between the User Exits, Customer Exits and Badi
- Inter Company Posting Text User Exit
- Transaction MIRO/MIGO/MR8M - New User Exit
- User Exits and BAdIs in SAP MM (Materials Management)
- ABAP/4 Reporting - User Enhancements
- ABAP user guide ,for making the reports.
- BAPI User Guide
- ABAP Objects (ABAP Programming in SAP NetWeaver)
- BC - ABAP Dictionary
- ABAP Programming & Coding Standards
- Official ABAP Programming Guidelines
- SAP BC - ABAP Programming
- BC - ABAP Programming
ABAP HANA Consultant Job | 5 - 8 yrs | Bengaluru | SAP India
Exp :3 - 5 years | City : Bangalore
SAP ABAP HR Certified Consultant
Exp :2 - 15 years | City : Delhi
SAP ISU EDM Consultant
Exp :5 - 15 years | City : Bangalore
Exp :2 - 7 years | City : Delhi
Urgent requirement |SAP SD Techno functional
Exp :5 - 11 years | City : Bangalore
SAP Hana Cloud Integeration | 6 - 9 Years | Pune | Atos
Exp :6 - 9 years | City : Pune
SAP ABAP Webdynpro | 4 - 9 Years | Pune, Bangalore | Atos
Exp :4 - 9 years | City : Bangalore
SAP SD | 4 - 8 Years | Ahmedabad | Gi Group
Exp :4 - 8 years | City : Ahmedabad
SAP ABAP Technical Consultant | 3 - 6 yrs | Bangalore | Inct
Exp :3 - 6 years | City : Bangalore
SAP FICO / SAP HCM/ SAP SD | 5 - 7 Years | Chennai | Hinduja
Exp :5 - 7 years | City : Chennai