Sapass

 Simplify SAP R/3 development with Excel VBA/VB RFC  
Home> UserExit>AFAR0004



Index

AFAR0004

User Exit for Depreciation Calc.Key
Using this SAP enhancement, you can influence the calculation of proportional values (depreciation) during asset retirement.

Activities

To set up this personalized calculation, you have to carry out the following activities:

  • Modify function module EXIT_SAPLAFAR_004 to your specific requirements (see example).
  • Aktivate a customer project using SAP standard enhancement AFAR0004 (function Project management of SAP Enhancements - transaction: CMOD).
  • The customer exit is not active for all retirements. It is only active for those retirements or transfers that are performed using a specific transaction type. In Customizing for retirement transaction types, there are special methods of handling retirement. This enhancement is linked to those transaction types that use special retirement treatment type '4'.

Parameters

Function module EXIT_SAPLAFAR_004 makes the following parameters available for determining retirement on an individual basis:

  • I_ANLC - annual values of the depreciation area that was last processed immediately before the retirement
  • I_ANLB - depreciation terms of this depreciation area
  • I_ANEP - line items of the retirement with the APC being retired
  • I_ANEA - proportional values before your own calculation, that is, these values are calculated again after the customer exit returns a percentage rate
  • I_CUMDEPR - total depreciation of the depreciation area

The expected return values are the percentage rate determined (E_PERCENTAGE) and an indicator E_AKTIV = 'X'.

In regard to the calculation of the E_PERCENTAGE return percentage rate, keep in mind that this percentage rate has to be determined in relationship to the total depreciation (I_CUMDEPR).

Example: Retirement amount I_ANEP-ANBTR = -2000

Based on this amount you calculate depreciation of 500 (equal to 25% of the retirement amount). The total depreciation on the asset is -5000 (I_CUMDEPR). The resulting return value E_PERCENTAGE is then -0.1 (500/ -5000).

This function module already contains an include to program ZXAFAU04. You have to create this included program yourself, and provide the program code that is required for your specific calculation. You have to use the names provided here in order for all of the data transferred to the customoer function module to be available.

Example

Below is simple example of how to implement function module EXIT_SAPLAFAR_004 :

Goal: During a partial retirement, you want to ensure that 80% of the retirement amount is always retired as proportional depreciation, as long as enough depreciation is available on the asset.


*---------------------------------------------------------------------*
* INCLUDE ZXAFAU04 *
*---------------------------------------------------------------------*
* Attention: retired APC is usually negative even the whole depr.
* percentage negative = depr. on the asset decrease
DATA: L_depr like I_CUMDEPR.
*
E_AKTIV = 'X'.
L_DEPR = I_ANEP-ANBTR * 80 / 100.
* calculated depreciation is usually negativ and can be compared with
* the whole depreciation. It is possible to retire 80 percent of APC if
* the calculated depreciation is less than the whole depreciation.
* Both values are negative which means that the calculated depreciation
* has to be greater (more positive) than thw whole depreciation.
IF L_DEPR > I_CUMDEPR.
E_PERCENTAGE = L_DEPR / I_CUMDEPR .
ELSE.
* E_PERCENTAGE = -1 means that the whole depreciation of the asset

Function/Program:
  • EXIT_SAPLAFAR_004: Customer-Specific Determination of Proportional Values at Retirement

02-Oct-2005