SAP CONVERT_FOREIGN_TO_FOREIGN_CUR Function Module for









CONVERT_FOREIGN_TO_FOREIGN_CUR is a standard convert foreign to foreign cur SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used to perform a specific ABAP function and below is the pattern details, 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 convert foreign to foreign cur FM, simply by entering the name CONVERT_FOREIGN_TO_FOREIGN_CUR into the relevant SAP transaction such as SE37 or SE38.

Function Group: CURR_CONVERSIONS
Program Name: SAPLCURR_CONVERSIONS
Main Program:
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:



Function CONVERT_FOREIGN_TO_FOREIGN_CUR 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 'CONVERT_FOREIGN_TO_FOREIGN_CUR'"
EXPORTING
* CLIENT = SY-MANDT "R/3 System, Client Number from Logon
DATE = "Conversion Date
* TYPE_OF_RATE = 'M' "Exchange Rate Type
FROM_AMOUNT = "
FROM_CURRENCY = "Initial currency
TO_CURRENCY = "Target Currency
LOCAL_CURRENCY = "Local Currency
* CONVERSION_MODE = "

IMPORTING
TO_AMOUNT = "

EXCEPTIONS
NO_RATE_FOUND = 1 OVERFLOW = 2 NO_FACTORS_FOUND = 3 NO_SPREAD_FOUND = 4 DERIVED_2_TIMES = 5
.



IMPORTING Parameters details for CONVERT_FOREIGN_TO_FOREIGN_CUR

CLIENT - R/3 System, Client Number from Logon

Data type: SY-MANDT
Default: SY-MANDT
Optional: Yes
Call by Reference: Yes

DATE - Conversion Date

Data type: SYST-DATUM
Optional: No
Call by Reference: Yes

TYPE_OF_RATE - Exchange Rate Type

Data type: TCURV-KURST
Default: 'M'
Optional: Yes
Call by Reference: Yes

FROM_AMOUNT -

Data type: P
Optional: No
Call by Reference: No ( called with pass by value option)

FROM_CURRENCY - Initial currency

Data type: TCURR-FCURR
Optional: No
Call by Reference: Yes

TO_CURRENCY - Target Currency

Data type: TCURR-TCURR
Optional: No
Call by Reference: Yes

LOCAL_CURRENCY - Local Currency

Data type: TCURR-TCURR
Optional: No
Call by Reference: Yes

CONVERSION_MODE -

Data type: XFELD
Optional: Yes
Call by Reference: Yes

EXPORTING Parameters details for CONVERT_FOREIGN_TO_FOREIGN_CUR

TO_AMOUNT -

Data type: P
Optional: No
Call by Reference: No ( called with pass by value option)

EXCEPTIONS details

NO_RATE_FOUND - No exch.rate entered in table TCURR

Data type:
Optional: No
Call by Reference: Yes

OVERFLOW - LOCAL_AMOUNT field is too small

Data type:
Optional: No
Call by Reference: Yes

NO_FACTORS_FOUND - No conversion factors in TCURF

Data type:
Optional: No
Call by Reference: Yes

NO_SPREAD_FOUND - No spread entered in table TCURS

Data type:
Optional: No
Call by Reference: Yes

DERIVED_2_TIMES - Exchange rate type derived more than once

Data type:
Optional: No
Call by Reference: Yes

Copy and paste ABAP code example for CONVERT_FOREIGN_TO_FOREIGN_CUR 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_client  TYPE SY-MANDT, "   SY-MANDT
lv_to_amount  TYPE P, "   
lv_no_rate_found  TYPE P, "   
lv_date  TYPE SYST-DATUM, "   
lv_overflow  TYPE SYST, "   
lv_type_of_rate  TYPE TCURV-KURST, "   'M'
lv_no_factors_found  TYPE TCURV, "   
lv_from_amount  TYPE P, "   
lv_no_spread_found  TYPE P, "   
lv_from_currency  TYPE TCURR-FCURR, "   
lv_derived_2_times  TYPE TCURR, "   
lv_to_currency  TYPE TCURR-TCURR, "   
lv_local_currency  TYPE TCURR-TCURR, "   
lv_conversion_mode  TYPE XFELD. "   

  CALL FUNCTION 'CONVERT_FOREIGN_TO_FOREIGN_CUR'  "
    EXPORTING
         CLIENT = lv_client
         DATE = lv_date
         TYPE_OF_RATE = lv_type_of_rate
         FROM_AMOUNT = lv_from_amount
         FROM_CURRENCY = lv_from_currency
         TO_CURRENCY = lv_to_currency
         LOCAL_CURRENCY = lv_local_currency
         CONVERSION_MODE = lv_conversion_mode
    IMPORTING
         TO_AMOUNT = lv_to_amount
    EXCEPTIONS
        NO_RATE_FOUND = 1
        OVERFLOW = 2
        NO_FACTORS_FOUND = 3
        NO_SPREAD_FOUND = 4
        DERIVED_2_TIMES = 5
. " CONVERT_FOREIGN_TO_FOREIGN_CUR




ABAP code using 7.40 inline data declarations to call FM CONVERT_FOREIGN_TO_FOREIGN_CUR

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 MANDT FROM SY INTO @DATA(ld_client).
DATA(ld_client) = SY-MANDT.
 
 
 
"SELECT single DATUM FROM SYST INTO @DATA(ld_date).
 
 
"SELECT single KURST FROM TCURV INTO @DATA(ld_type_of_rate).
DATA(ld_type_of_rate) = 'M'.
 
 
 
 
"SELECT single FCURR FROM TCURR INTO @DATA(ld_from_currency).
 
 
"SELECT single TCURR FROM TCURR INTO @DATA(ld_to_currency).
 
"SELECT single TCURR FROM TCURR INTO @DATA(ld_local_currency).
 
 


Search for further information about these or an SAP related objects



Comments on this SAP object

What made you want to lookup this SAP object? Please tell us what you were looking for and anything you would like to be included on this page!