SAP FOREX_RATE_INVERT Function Module for Invert Exchange Rates in Accordance with Customizing Settings
FOREX_RATE_INVERT is a standard forex rate invert SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Invert Exchange Rates in Accordance with Customizing Settings 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 forex rate invert FM, simply by entering the name FOREX_RATE_INVERT into the relevant SAP transaction such as SE37 or SE38.
Function Group: FTX2
Program Name: SAPLFTX2
Main Program: SAPLFTX2
Appliation area: F
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function FOREX_RATE_INVERT 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 'FOREX_RATE_INVERT'"Invert Exchange Rates in Accordance with Customizing Settings.
EXPORTING
WLWAERS = "
WFWAERS = "
RATE = "
IMPORTING
INV_WLWAERS = "
INV_WFWAERS = "
INV_RATE = "
EXCEPTIONS
CURRPAIR_NOT_DEFINED = 1 RATE_FAILURE = 2
IMPORTING Parameters details for FOREX_RATE_INVERT
WLWAERS -
Data type: VTBFHAZU-WLWAERSOptional: No
Call by Reference: No ( called with pass by value option)
WFWAERS -
Data type: VTBFHAZU-WFWAERSOptional: No
Call by Reference: No ( called with pass by value option)
RATE -
Data type: VTBFHAZU-KKURSOptional: No
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for FOREX_RATE_INVERT
INV_WLWAERS -
Data type: VTBFHAZU-WLWAERSOptional: No
Call by Reference: No ( called with pass by value option)
INV_WFWAERS -
Data type: VTBFHAZU-WFWAERSOptional: No
Call by Reference: No ( called with pass by value option)
INV_RATE -
Data type: VTBFHAZU-KKURSOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
CURRPAIR_NOT_DEFINED -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
RATE_FAILURE -
Data type:Optional: No
Call by Reference: Yes
Copy and paste ABAP code example for FOREX_RATE_INVERT 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_wlwaers | TYPE VTBFHAZU-WLWAERS, " | |||
| lv_inv_wlwaers | TYPE VTBFHAZU-WLWAERS, " | |||
| lv_currpair_not_defined | TYPE VTBFHAZU, " | |||
| lv_wfwaers | TYPE VTBFHAZU-WFWAERS, " | |||
| lv_inv_wfwaers | TYPE VTBFHAZU-WFWAERS, " | |||
| lv_rate_failure | TYPE VTBFHAZU, " | |||
| lv_rate | TYPE VTBFHAZU-KKURS, " | |||
| lv_inv_rate | TYPE VTBFHAZU-KKURS. " |
|   CALL FUNCTION 'FOREX_RATE_INVERT' "Invert Exchange Rates in Accordance with Customizing Settings |
| EXPORTING | ||
| WLWAERS | = lv_wlwaers | |
| WFWAERS | = lv_wfwaers | |
| RATE | = lv_rate | |
| IMPORTING | ||
| INV_WLWAERS | = lv_inv_wlwaers | |
| INV_WFWAERS | = lv_inv_wfwaers | |
| INV_RATE | = lv_inv_rate | |
| EXCEPTIONS | ||
| CURRPAIR_NOT_DEFINED = 1 | ||
| RATE_FAILURE = 2 | ||
| . " FOREX_RATE_INVERT | ||
ABAP code using 7.40 inline data declarations to call FM FOREX_RATE_INVERT
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 WLWAERS FROM VTBFHAZU INTO @DATA(ld_wlwaers). | ||||
| "SELECT single WLWAERS FROM VTBFHAZU INTO @DATA(ld_inv_wlwaers). | ||||
| "SELECT single WFWAERS FROM VTBFHAZU INTO @DATA(ld_wfwaers). | ||||
| "SELECT single WFWAERS FROM VTBFHAZU INTO @DATA(ld_inv_wfwaers). | ||||
| "SELECT single KKURS FROM VTBFHAZU INTO @DATA(ld_rate). | ||||
| "SELECT single KKURS FROM VTBFHAZU INTO @DATA(ld_inv_rate). | ||||
Search for further information about these or an SAP related objects