Para Birimi Dönüşümü (Convert Currency)
CONVERT_TO_LOCAL_CURRENCY
IF es_salesorder-waerk NE lv_waerk AND es_salesorder-tax NE `0.00`.
PERFORM f_convert_currency USING lv_waerk es_salesorder-waerk
CHANGING es_salesorder-tax.
ENDIF.
*&---------------------------------------------------------------------*
*& Form F_CONVERT_CURRENCY
*&---------------------------------------------------------------------*
FORM f_convert_currency USING p_fcurr
p_tcurr
CHANGING p_amount.
DATA: lv_famount TYPE netwr_ap,
lv_tamount TYPE netwr_ap,
lv_rate TYPE netwr_ap.
CLEAR: lv_tamount, lv_rate.
lv_famount = p_amount.
CALL FUNCTION `CONVERT_TO_LOCAL_CURRENCY`
EXPORTING
date = sy-datum
foreign_amount = lv_famount
foreign_currency = p_fcurr
local_currency = p_tcurr
type_of_rate = `M`
IMPORTING
exchange_rate = lv_rate
local_amount = lv_tamount
EXCEPTIONS
no_rate_found = 1
overflow = 2
no_factors_found = 3
no_spread_found = 4
derived_2_times = 5
others = 6.
IF sy-subrc EQ 0.
p_amount = lv_tamount.
ELSE.
CLEAR p_amount.
ENDIF.
ENDFORM.