汇率转换的计算,可以采用以下BAPI函数进行获取不同货币之间的转换汇率.
BAPI:BAPI_EXCHANGERATE_GETDETAIL
代码如下:
DATA:ls_exch_rate TYPE bapi1093_0.
CLEAR ls_exch_rate.
CALL FUNCTION 'BAPI_EXCHANGERATE_GETDETAIL'
EXPORTING
rate_type = 'M' " 固定M
from_curr = 'USD' " 从USD转换为CNY
to_currncy = 'CNY'
date = sy-datum " 当前日期
IMPORTING
exch_rate = ls_exch_rate.
* ls_exch_rate-exch_rate 为汇率
* ls_exch_rate-from_factor 为转换因子
IF ls_exch_rate-exch_rate IS NOT INITIAL.
ls_account-amount = <fs_ukm_totals>-amount * ls_exch_rate-exch_rate.
ENDIF.