Sapass

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



Index

AFAR0001

User Exit for Depreciation Calc.Key
Using this SAP enhancement, you can determine your own base value for multi-level methods for calcuating depreciation.

Activities

You need to carry out the following activities to make this individual determination of the base value possible:

  • Add to the fixed values in the domain BEZWKZ using the Dictionary function (SE11).
    The fixed values ZA to ZZ are already defined in domain BEZWK for customer enhancements. You can use these fixed values for your individual determination of base values. Modify the short texts for these fixed values according to their use. Then activate the domain in order to make the changes accessible.
  • Modify function module EXIT_SAPLAFAR_001 to your specific requirements (see the example).
  • Activate the project AFAR0001 using the function Project management of SAP enhancements (CMOD).

Parameters

Function module EXIT_SAPLAFAR_001 offers the following parameters for the determination of base value:

  • I_AFABE - Depreciation area, for which the base value should be determined
  • I_ANLB - Depreciation terms of this depreciation area
  • I_ANTS - Partial structure of the asset master record (ANLA)
  • I_BEZWKZ - Base value indicators (ZA bis ZZ).
  • I_GANLC - GANLC structure of the line item that is currently being calculated. The GANLC structure contains the amount fields of table ANLC.

In addition, you can access the following in local copies of the tables:

  • T_ANEA - Asset line items, proportional values
  • T_ANEP - Asset line items
  • T_ANLC - Asset value fields. At a given point in time, this totals table considers all line items up to but excluding the line item that is currently being calculated.
  • T_ANLZ - asset allocations, for which the value date is set (for which a from and to date is set)

The only return value that is expected is the base value (E_BEZWRT). This function module already contains an include of the program ZXAFAU01. You have to create this included program yourself. You must provide this program with the program coding necessary for your individual determination of the base value. You must use the names given in order for all your customer-specific data to be available.

Example

Below is a simple example for programming the function module EXIT_SAPLAFAR_001:


*---------------------------------------------------------------------*
* INCLUDE ZXAFAU01 *
*---------------------------------------------------------------------*
* Determination of the base values ZZ (acquisition value), ZY
* (half of acquisition value), and ZX (replacement value)
*
DATA: CON_BEZWKZ_ZZ LIKE T090P-BEZWKZ VALUE 'ZZ',
CON_BEZWKZ_ZY LIKE T090P-BEZWKZ VALUE 'ZY',
CON_BEZWKZ_ZX LIKE T090P-BEZWKZ VALUE 'ZX'.

LOOP AT T_ANLC WHERE AFABE = I_AFABE.
E_BEZWRT = 0.
CASE I_BEZWKZ.
* acquisition value
WHEN CON_BEZWKZ_ZZ.
E_BEZWRT = T_ANLC-KANSW + T_ANLC-ANSWL +
T_ANLC-KMAFA + T_ANLC-MAFAV + T_ANLC-ZUSMA +
T_ANLC-MAFAM + T_ANLC-MAFAL .
* half acquisition value
WHEN CON_BEZWKZ_ZY.
E_BEZWRT = ( T_ANLC-KANSW + T_ANLC-ANSWL +
T_ANLC-KMAFA + T_ANLC-MAFAV + T_ANLC-ZUSMA +
T_ANLC-MAFAM + T_ANLC-MAFAL ) / 2.
* replacement value
WHEN CON_BEZWKZ_ZX.
E_BEZWRT = T_ANLC-KANSW + T_ANLC-ANSWL +
T_ANLC-KMAFA + T_ANLC-MAFAV + T_ANLC-ZUSMA +
T_ANLC-MAFAM + T_ANLC-MAFAL +
T_ANLC-KAUFW + T_ANLC-AUFWV +

Function/Program:
  • EXIT_SAPLAFAR_001: Allows Modification of Base Value for Depreciation Calculation

02-Oct-2005