SAP Function Modules

COPA_CONVERT_TO_LF_CURRENCY SAP Function module







COPA_CONVERT_TO_LF_CURRENCY is a standard SAP function module available within R/3 SAP systems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import and export parameters, exceptions etc as well as any documentation contributions (Comments) specific to the object.

See here to view full function module documentation and code listing, simply by entering the name COPA_CONVERT_TO_LF_CURRENCY into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: KECU
Released Date: Not Released
Processing type: Normal fucntion module
Normal function module settings


Pattern for FM COPA_CONVERT_TO_LF_CURRENCY - COPA CONVERT TO LF CURRENCY





CALL FUNCTION 'COPA_CONVERT_TO_LF_CURRENCY' "
  EXPORTING
    i_erkrs =                   " tkebb-erkrs
    i_date =                    " sy-datum
    i_currency_from =           "
    i_amount_from =             "
    i_currency_to =             "
*   i_rate = 0                  "
*   i_type_of_rate = 'M'        "
*   i_convert_to = 'L'          "
  IMPORTING
    e_exchange_rate =           "
    e_foreign_factor =          "
    e_amount_to =               "
    e_local_factor =            "
    e_exchange_ratex =          "
  EXCEPTIONS
    CONVERSION_ERROR = 1        "
    .  "  COPA_CONVERT_TO_LF_CURRENCY

ABAP code example for Function Module COPA_CONVERT_TO_LF_CURRENCY





The ABAP code below is a full code listing to execute function module COPA_CONVERT_TO_LF_CURRENCY including all data declarations. The code uses 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 original method of declaring data variables up front. 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).

DATA:
ld_e_exchange_rate  TYPE STRING ,
ld_e_foreign_factor  TYPE STRING ,
ld_e_amount_to  TYPE STRING ,
ld_e_local_factor  TYPE STRING ,
ld_e_exchange_ratex  TYPE STRING .


SELECT single ERKRS
FROM TKEBB
INTO @DATA(ld_i_erkrs).

DATA(ld_i_date) = '20210129'.
DATA(ld_i_currency_from) = 'some text here'.
DATA(ld_i_amount_from) = 'some text here'.
DATA(ld_i_currency_to) = 'some text here'.
DATA(ld_i_rate) = 'some text here'.
DATA(ld_i_type_of_rate) = 'some text here'.
DATA(ld_i_convert_to) = 'some text here'. . CALL FUNCTION 'COPA_CONVERT_TO_LF_CURRENCY' EXPORTING i_erkrs = ld_i_erkrs i_date = ld_i_date i_currency_from = ld_i_currency_from i_amount_from = ld_i_amount_from i_currency_to = ld_i_currency_to * i_rate = ld_i_rate * i_type_of_rate = ld_i_type_of_rate * i_convert_to = ld_i_convert_to IMPORTING e_exchange_rate = ld_e_exchange_rate e_foreign_factor = ld_e_foreign_factor e_amount_to = ld_e_amount_to e_local_factor = ld_e_local_factor e_exchange_ratex = ld_e_exchange_ratex EXCEPTIONS CONVERSION_ERROR = 1 . " COPA_CONVERT_TO_LF_CURRENCY
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "Exception "Add code for exception here ENDIF.







ABAP code to compare 7.40 inline data declaration with original syntax

The below ABAP code uses the older none in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. It may also be useful if you are using an older version of SAP as some of the newer syntax above, such as the @DATA is not available until 4.70 EHP 8.

DATA:
ld_e_exchange_rate  TYPE STRING ,
ld_i_erkrs  TYPE TKEBB-ERKRS ,
ld_e_foreign_factor  TYPE STRING ,
ld_i_date  TYPE SY-DATUM ,
ld_e_amount_to  TYPE STRING ,
ld_i_currency_from  TYPE STRING ,
ld_e_local_factor  TYPE STRING ,
ld_i_amount_from  TYPE STRING ,
ld_e_exchange_ratex  TYPE STRING ,
ld_i_currency_to  TYPE STRING ,
ld_i_rate  TYPE STRING ,
ld_i_type_of_rate  TYPE STRING ,
ld_i_convert_to  TYPE STRING .


SELECT single ERKRS
FROM TKEBB
INTO ld_i_erkrs.

ld_i_date = '20210129'.
ld_i_currency_from = 'some text here'.
ld_i_amount_from = 'some text here'.
ld_i_currency_to = 'some text here'.
ld_i_rate = 'some text here'.
ld_i_type_of_rate = 'some text here'.
ld_i_convert_to = 'some text here'.

Contribute (Add Comments)

Please help keep this info upto date and use the comments section below to add useful hints, tips and information specific to this SAP function. This will then be available for you and other users to easily find by simply searching on the object name COPA_CONVERT_TO_LF_CURRENCY or its description.