SAP PRICE_CALCULATION_LAC Function Module for Amortized Cost Price Determination (Linear)
PRICE_CALCULATION_LAC is a standard price calculation lac SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Amortized Cost Price Determination (Linear) processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.
See here to view full function module documentation and code listing for price calculation lac FM, simply by entering the name PRICE_CALCULATION_LAC into the relevant SAP transaction such as SE37 or SE38.
Function Group: FWAC
Program Name: SAPLFWAC
Main Program:
Appliation area: F
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function PRICE_CALCULATION_LAC pattern details
In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.CALL FUNCTION 'PRICE_CALCULATION_LAC'"Amortized Cost Price Determination (Linear).
EXPORTING
I_BUKRS = "Company Code
I_RANL = "ID Number
* I_RLDEPO = "Securities Account
I_REVAL = "akkumulierte Bestände
* I_STICHTAG = SY-DATUM "Stichtag (zur Restlaufzeitermittlung)
* I_LAUFZEITMETHODE = 'J' "J(ahre) oder T(age)
* I_ENDF = ' ' "'X' = Berechnung nur mit Endfälligkeitsdatum
IMPORTING
E_PWKURS = "Neuer Kurs nach LAC
E_PWKURS_ALT = "Alter Kurs
E_LAUFZEIT = "Laufzeit in Jahren oder Tagen (Methode)
EXCEPTIONS
DIVISION_BY_ZERO = 1 DURATION_NOT_COMPUTABLE = 2 DURATION_IS_NEGATIVE = 3
IMPORTING Parameters details for PRICE_CALCULATION_LAC
I_BUKRS - Company Code
Data type: VWBEPP-BUKRSOptional: No
Call by Reference: No ( called with pass by value option)
I_RANL - ID Number
Data type: VWBEPP-RANLOptional: No
Call by Reference: No ( called with pass by value option)
I_RLDEPO - Securities Account
Data type: VWBEPP-RLDEPOOptional: Yes
Call by Reference: No ( called with pass by value option)
I_REVAL - akkumulierte Bestände
Data type: REVALOptional: No
Call by Reference: No ( called with pass by value option)
I_STICHTAG - Stichtag (zur Restlaufzeitermittlung)
Data type: SY-DATUMDefault: SY-DATUM
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_LAUFZEITMETHODE - J(ahre) oder T(age)
Data type: CDefault: 'J'
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_ENDF - 'X' = Berechnung nur mit Endfälligkeitsdatum
Data type: CDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for PRICE_CALCULATION_LAC
E_PWKURS - Neuer Kurs nach LAC
Data type: VWBEPP-PWKURSOptional: No
Call by Reference: No ( called with pass by value option)
E_PWKURS_ALT - Alter Kurs
Data type: VWBEPP-PWKURSOptional: No
Call by Reference: No ( called with pass by value option)
E_LAUFZEIT - Laufzeit in Jahren oder Tagen (Methode)
Data type: IOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
DIVISION_BY_ZERO -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
DURATION_NOT_COMPUTABLE -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
DURATION_IS_NEGATIVE -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for PRICE_CALCULATION_LAC Function Module
The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.| DATA: | ||||
| lv_i_bukrs | TYPE VWBEPP-BUKRS, " | |||
| lv_e_pwkurs | TYPE VWBEPP-PWKURS, " | |||
| lv_division_by_zero | TYPE VWBEPP, " | |||
| lv_i_ranl | TYPE VWBEPP-RANL, " | |||
| lv_e_pwkurs_alt | TYPE VWBEPP-PWKURS, " | |||
| lv_duration_not_computable | TYPE VWBEPP, " | |||
| lv_i_rldepo | TYPE VWBEPP-RLDEPO, " | |||
| lv_e_laufzeit | TYPE I, " | |||
| lv_duration_is_negative | TYPE I, " | |||
| lv_i_reval | TYPE REVAL, " | |||
| lv_i_stichtag | TYPE SY-DATUM, " SY-DATUM | |||
| lv_i_laufzeitmethode | TYPE C, " 'J' | |||
| lv_i_endf | TYPE C. " SPACE |
|   CALL FUNCTION 'PRICE_CALCULATION_LAC' "Amortized Cost Price Determination (Linear) |
| EXPORTING | ||
| I_BUKRS | = lv_i_bukrs | |
| I_RANL | = lv_i_ranl | |
| I_RLDEPO | = lv_i_rldepo | |
| I_REVAL | = lv_i_reval | |
| I_STICHTAG | = lv_i_stichtag | |
| I_LAUFZEITMETHODE | = lv_i_laufzeitmethode | |
| I_ENDF | = lv_i_endf | |
| IMPORTING | ||
| E_PWKURS | = lv_e_pwkurs | |
| E_PWKURS_ALT | = lv_e_pwkurs_alt | |
| E_LAUFZEIT | = lv_e_laufzeit | |
| EXCEPTIONS | ||
| DIVISION_BY_ZERO = 1 | ||
| DURATION_NOT_COMPUTABLE = 2 | ||
| DURATION_IS_NEGATIVE = 3 | ||
| . " PRICE_CALCULATION_LAC | ||
ABAP code using 7.40 inline data declarations to call FM PRICE_CALCULATION_LAC
The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.| "SELECT single BUKRS FROM VWBEPP INTO @DATA(ld_i_bukrs). | ||||
| "SELECT single PWKURS FROM VWBEPP INTO @DATA(ld_e_pwkurs). | ||||
| "SELECT single RANL FROM VWBEPP INTO @DATA(ld_i_ranl). | ||||
| "SELECT single PWKURS FROM VWBEPP INTO @DATA(ld_e_pwkurs_alt). | ||||
| "SELECT single RLDEPO FROM VWBEPP INTO @DATA(ld_i_rldepo). | ||||
| "SELECT single DATUM FROM SY INTO @DATA(ld_i_stichtag). | ||||
| DATA(ld_i_stichtag) | = SY-DATUM. | |||
| DATA(ld_i_laufzeitmethode) | = 'J'. | |||
| DATA(ld_i_endf) | = ' '. | |||
Search for further information about these or an SAP related objects