SAP F4_EXCHANGE_RATE Function Module for









F4_EXCHANGE_RATE is a standard f4 exchange rate 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 f4 exchange rate FM, simply by entering the name F4_EXCHANGE_RATE into the relevant SAP transaction such as SE37 or SE38.

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



Function F4_EXCHANGE_RATE 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 'F4_EXCHANGE_RATE'"
EXPORTING
* TYPE_OF_RATE = 'M' "Exchange Rate Type
DATE = "Currency translation date
FOREIGN_CURRENCY = "'From' currency
LOCAL_CURRENCY = "'To' currency
* FIELDNAME = "
* DYNAME = "
* DYNUMB = "
* DISPLAY_ONLY = ' ' "

CHANGING
* KURS = "Exchange Rate

EXCEPTIONS
INSUFFICIENT_INPUT = 1 FOREIGN_EQ_LOCAL = 2
.



IMPORTING Parameters details for F4_EXCHANGE_RATE

TYPE_OF_RATE - Exchange Rate Type

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

DATE - Currency translation date

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

FOREIGN_CURRENCY - 'From' currency

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

LOCAL_CURRENCY - 'To' currency

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

FIELDNAME -

Data type: DYNPREAD-FIELDNAME
Optional: Yes
Call by Reference: Yes

DYNAME -

Data type: D020S-PROG
Optional: Yes
Call by Reference: No ( called with pass by value option)

DYNUMB -

Data type: D020S-DNUM
Optional: Yes
Call by Reference: No ( called with pass by value option)

DISPLAY_ONLY -

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

CHANGING Parameters details for F4_EXCHANGE_RATE

KURS - Exchange Rate

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

EXCEPTIONS details

INSUFFICIENT_INPUT -

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

FOREIGN_EQ_LOCAL -

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

Copy and paste ABAP code example for F4_EXCHANGE_RATE 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_kurs  TYPE TCURR-UKURS, "   
lv_type_of_rate  TYPE TCURV-KURST, "   'M'
lv_insufficient_input  TYPE TCURV, "   
lv_date  TYPE SY-DATUM, "   
lv_foreign_eq_local  TYPE SY, "   
lv_foreign_currency  TYPE TCURR-FCURR, "   
lv_local_currency  TYPE TCURR-TCURR, "   
lv_fieldname  TYPE DYNPREAD-FIELDNAME, "   
lv_dyname  TYPE D020S-PROG, "   
lv_dynumb  TYPE D020S-DNUM, "   
lv_display_only  TYPE XFELD. "   ' '

  CALL FUNCTION 'F4_EXCHANGE_RATE'  "
    EXPORTING
         TYPE_OF_RATE = lv_type_of_rate
         DATE = lv_date
         FOREIGN_CURRENCY = lv_foreign_currency
         LOCAL_CURRENCY = lv_local_currency
         FIELDNAME = lv_fieldname
         DYNAME = lv_dyname
         DYNUMB = lv_dynumb
         DISPLAY_ONLY = lv_display_only
    CHANGING
         KURS = lv_kurs
    EXCEPTIONS
        INSUFFICIENT_INPUT = 1
        FOREIGN_EQ_LOCAL = 2
. " F4_EXCHANGE_RATE




ABAP code using 7.40 inline data declarations to call FM F4_EXCHANGE_RATE

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 UKURS FROM TCURR INTO @DATA(ld_kurs).
 
"SELECT single KURST FROM TCURV INTO @DATA(ld_type_of_rate).
DATA(ld_type_of_rate) = 'M'.
 
 
"SELECT single DATUM FROM SY INTO @DATA(ld_date).
 
 
"SELECT single FCURR FROM TCURR INTO @DATA(ld_foreign_currency).
 
"SELECT single TCURR FROM TCURR INTO @DATA(ld_local_currency).
 
"SELECT single FIELDNAME FROM DYNPREAD INTO @DATA(ld_fieldname).
 
"SELECT single PROG FROM D020S INTO @DATA(ld_dyname).
 
"SELECT single DNUM FROM D020S INTO @DATA(ld_dynumb).
 
DATA(ld_display_only) = ' '.
 


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!