*汇率可以去表TCURR查看
*注:有些货币如JPY内部金额和外部金额是不一样的,需要调用函数转换,再进行汇率转换
DATA:for_cur TYPE waers,
for_am TYPE ukm_comm_actual_item,
loc_cur TYPE waers,
loc_am TYPE ukm_comm_actual_item.
loc_cur = 'CNY' .
for_cur = 'USD' .
for_am = '123' .
for_am = for_am * 100 .
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
* CLIENT = SY-MANDT
date = sy-datum
foreign_amount = for_am
foreign_currency = for_cur
local_currency = loc_cur
* RATE = 0
* TYPE_OF_RATE = 'M'
* READ_TCURR = 'X'
IMPORTING
* EXCHANGE_RATE =
* FOREIGN_FACTOR =
local_amount = loc_am
* 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 loc_am IS NOT INITIAL .
loc_am = loc_am / 100 .
ENDIF .
ABAP-货币汇率转换函数
最新推荐文章于 2024-07-06 06:30:00 发布
本文介绍了在ABAP编程中如何使用SY-MANDTAPI进行货币转换,涉及特定货币类型(如JPY),并展示了如何调用CONVERT_TO_LOCAL_CURRENCY函数,处理不同货币间的汇率转换,确保金额一致性。
摘要由CSDN通过智能技术生成