Sapass

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



Index

AFAR0002

User Exit for Depreciation Calc.Key
Using this SAP enhancement, you can determine the depreciation amount for an asset transaction based on your own specifications.

Activities

For this user-specific determination of depreciation, you need to carry out the following steps:

  • Modify function module EXIT_SAPLAFAR_002 according to your specific requirements (see the example).
  • Activate a customer enhancement project using the SAP standard enhancement AFAR0002 (Function Project management of SAP enhancements - Transaction: CMOD).

Parameters

Function module EXIT_SAPLAFAR_002 offers the following parameters for determining depreciation:

  • I_AFABE - depreciation area, for which depreciation is determined
  • I_ANLB - depreciation terms in this depreciation area
  • I_ANTS - partial structure of the asset master record (ANLA)
  • I_BEZWRT - base value
  • I_AFAP - specific depreciation terms

You can also access local copies of the tables

  • T_ANEA - proportional values for asset line items
  • T_ANEP - asset line items
  • T_ANLC - asset value fields
  • T_ANLZ - asset assignment with validity date

The expected return values are the depreciation amount determined (E_AFABTR) and the capitalization indicator E_AKTIV = 'X'.

There is already an include in the function module to program ZXAFAU02. You have to create this included program yourself. Provide it with the program code necessary for determining your specific depreciation amounts. You have to use the specified names, in order to ensure that all of the data that was transferred to to the user-defined function module is available. Below is a simple example for function module EXIT_SAPLAFAR_002:


*---------------------------------------------------------------------*
* INCLUDE ZXAFAU02 *
*---------------------------------------------------------------------*
* Use of depreciation methods ZA (fixed percentage),
* ZB (unit-of-prod.), ZC (40% fixed and 60% based on units) and
* ZD (fixed amount)
*
DATA: CON_AFAMETH_ZA LIKE T090-AFAMET VALUE 'ZA',
CON_AFAMETH_ZB LIKE T090-AFAMET VALUE 'ZB',
CON_AFAMETH_ZC LIKE T090-AFAMET VALUE 'ZC',
CON_AFAMETH_ZD LIKE T090-AFAMET VALUE 'ZD',
L_AFABTR TYPE F.

E_AKTIV = 'X'.
E_AFABTR = 0.
LOOP AT T_ANLC WHERE AFABE = I_AFABE.
L_AFABTR = 0.
CASE I_AFAP-AFAMET.
* fix percentage
WHEN CON_AFAMETH_ZA.
L_AFABTR = I_BEZWRT * 0.123456789123
* I_AFAP-PERAFAGW / I_AFAP-PERFY.
* Unit of Production
WHEN CON_AFAMETH_ZB.
L_AFABTR = I_BEZWRT * I_AFAP-STKAFA / I_AFAP-STKGES
* I_AFAP-PERAFAGW / I_AFAP-PERFY.
* 40 % fix percentage and 60 % Unit of Production
WHEN CON_AFAMETH_ZC.
L_AFABTR = ( I_BEZWRT * 0.4 * 0.123456789123 +
I_BEZWRT * 0.6 * I_AFAP-STKAFA / I_AFAP-STKGES )
* I_AFAP-PERAFAGW / I_AFAP-PERFY.
Function/Program:
  • EXIT_SAPLAFAR_002: Customer-Specific Calculation of Depreciation on Transaction

02-Oct-2005