//汇率转换
form get_curr_price using u_price u_curr changing c_price.
data: t_factor type p decimals 3.
call function 'CURRENCY_CONVERTING_FACTOR'
exporting
currency = u_curr
importing
factor = t_factor
exceptions
too_many_decimals = 1
others = 2.
endform.
==================================================
call function 'CONVERT_TO_LOCAL_CURRENCY'
exporting
date = p_shpdat
foreign_amount = 1
foreign_currency = 'USD'
local_currency = 'RMB'
type_of_rate = 'M'
importing
exchange_rate = t_rate.
=====================================================
//传入参数,通过计算再返回另一数据;本例中传入t_date,返回c_text.
FORM GET_EXCHANGE_RATE using t_date changing c_text.
" EXCHANGE RATE LINK FINANCIAL
clear c_text.
if t_date is initial.
t_date = sy-datum.
endif.
CALL FUNCTION 'READ_EXCHANGE_RATE'
EXPORTING
DATE = t_date
FOREIGN_CURRENCY = 'USD'
LOCAL_CURRENCY = 'RMB'
IMPORTING
EXCHANGE_RATE = c_text.
IF c_text IS INITIAL .
MESSAGE E199(ZX) WITH 'EXCHANGE RATE IS MISSING ' 'USD<->RMB' .
ENDIF.
ENDFORM. " GET_EXCHANGE_RATE