2022 Nov 15 6:42 PM
I was trying to convert EUR to CHF from a purchase order and I'm currently having a brain fog.
The Exchange rate is 1.08085 as seen in ME23N.However, I'm not sure if I would divide or multiply the EUR with the exchange rate so I'm trying it with the function module CONVERT_TO_LOCAL_CURRENCY. However, no values were returned upon trying in SE37.
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
* CLIENT = SY-MANDT
date = sy-datum
foreign_amount = 73.72
foreign_currency = EUR
local_currency = CHF
RATE = 1.08085
* TYPE_OF_RATE = 'M'
* READ_TCURR = 'X'
* IMPORTING
* EXCHANGE_RATE =
* FOREIGN_FACTOR =
* LOCAL_AMOUNT =
* LOCAL_FACTOR =
* EXCHANGE_RATEX =
* FIXED_RATE =
* DERIVED_RATE_TYPE =
* EXCEPTIONS
* NO_RATE_FOUND = 1
* OVERFLOW = 2
* NO_FACTORS_FOUND = 3
* NO_SPREAD_FOUND = 4
* DERIVED_2_TIMES = 5
* OTHERS = 6
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
2022 Nov 15 7:14 PM
Invalid code. You must indicate quotes for decimal number literals (and text literals too, of course), and indicate a variable for the exporting parameters. Did you try only in SE37, or in ABAP program. I advise to always test in ABAP program, especially when SE37 doesn't work.
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
date = sy-datum
foreign_amount = '73.72'
foreign_currency = 'EUR'
local_currency = 'CHF'
RATE = '1.08085'
...
IMPORTING
LOCAL_AMOUNT = local_amount.