1. 示例
PARAMETERS: p_waers TYPE mseg-waers OBLIGATORY DEFAULT 'USD'.
SELECT SUM( currency_conversion( amount = a~hsl, "转换的金额
source_currency = b~isocd, "源货币
target_currency = @p_waers, "目标货币
exchange_rate_date = @sy-datum, "汇率日期
exchange_rate_type = 'M', "汇率类型
round = @abap_true, "是否Round
on_error = @sql_currency_conversion=>c_on_error-fail ) ) AS amount_total
FROM acdoca AS a
LEFT JOIN tcurc AS b ON a~rhcur = b~waers
WHERE a~rhcur = 'RMB'
INTO TABLE @DATA(lt_data)
UP TO 100 ROWS.
cl_demo_output=>display( lt_data ).
2. 效果
- 转换为 USD
- 转换为JPY