SAP Function Modules

OIC_CONVERT_USING_KNOWN_RATE SAP Function module - Conversion of Foreign Currency Amount into Local Currency Using Known Ra







OIC_CONVERT_USING_KNOWN_RATE 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 OIC_CONVERT_USING_KNOWN_RATE into the relevant SAP transaction such as SE37 or SE80.

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


Pattern for FM OIC_CONVERT_USING_KNOWN_RATE - OIC CONVERT USING KNOWN RATE





CALL FUNCTION 'OIC_CONVERT_USING_KNOWN_RATE' "Conversion of Foreign Currency Amount into Local Currency Using Known Rate
* EXPORTING
*   date =                      " sy-datum
*   foreign_amount =            "
*   foreign_currency =          "
*   local_currency =            "
*   rate = 0                    "
*   type_of_rate = 'M'          "
*   foreign_factor =            "
*   local_factor =              "
  IMPORTING
    exchange_rate =             "
    local_amount =              "
    exchange_ratex =            "
  EXCEPTIONS
    NO_RATE_FOUND = 1           "
    OVERFLOW = 2                "
    NO_FACTORS_FOUND = 3        "
    NO_SPREAD_FOUND = 4         "
    DERIVED_2_TIMES = 5         "
    OTHERS = 6                  "
    .  "  OIC_CONVERT_USING_KNOWN_RATE

ABAP code example for Function Module OIC_CONVERT_USING_KNOWN_RATE





The ABAP code below is a full code listing to execute function module OIC_CONVERT_USING_KNOWN_RATE 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_exchange_rate  TYPE STRING ,
ld_local_amount  TYPE STRING ,
ld_exchange_ratex  TYPE STRING .

DATA(ld_date) = '20210129'.
DATA(ld_foreign_amount) = 'some text here'.
DATA(ld_foreign_currency) = 'some text here'.
DATA(ld_local_currency) = 'some text here'.
DATA(ld_rate) = 'some text here'.
DATA(ld_type_of_rate) = 'some text here'.
DATA(ld_foreign_factor) = 'some text here'.
DATA(ld_local_factor) = 'some text here'. . CALL FUNCTION 'OIC_CONVERT_USING_KNOWN_RATE' * EXPORTING * date = ld_date * foreign_amount = ld_foreign_amount * foreign_currency = ld_foreign_currency * local_currency = ld_local_currency * rate = ld_rate * type_of_rate = ld_type_of_rate * foreign_factor = ld_foreign_factor * local_factor = ld_local_factor IMPORTING exchange_rate = ld_exchange_rate local_amount = ld_local_amount exchange_ratex = ld_exchange_ratex EXCEPTIONS NO_RATE_FOUND = 1 OVERFLOW = 2 NO_FACTORS_FOUND = 3 NO_SPREAD_FOUND = 4 DERIVED_2_TIMES = 5 OTHERS = 6 . " OIC_CONVERT_USING_KNOWN_RATE
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 2. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 3. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 4. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 5. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 6. "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_exchange_rate  TYPE STRING ,
ld_date  TYPE SY-DATUM ,
ld_local_amount  TYPE STRING ,
ld_foreign_amount  TYPE STRING ,
ld_exchange_ratex  TYPE STRING ,
ld_foreign_currency  TYPE STRING ,
ld_local_currency  TYPE STRING ,
ld_rate  TYPE STRING ,
ld_type_of_rate  TYPE STRING ,
ld_foreign_factor  TYPE STRING ,
ld_local_factor  TYPE STRING .

ld_date = '20210129'.
ld_foreign_amount = 'some text here'.
ld_foreign_currency = 'some text here'.
ld_local_currency = 'some text here'.
ld_rate = 'some text here'.
ld_type_of_rate = 'some text here'.
ld_foreign_factor = 'some text here'.
ld_local_factor = '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 OIC_CONVERT_USING_KNOWN_RATE or its description.